Skip to content

Instantly share code, notes, and snippets.

@geoffgarside
Created September 22, 2008 20:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffgarside/12154 to your computer and use it in GitHub Desktop.
Save geoffgarside/12154 to your computer and use it in GitHub Desktop.
Ruby Easter Calculation
def easter
y = Time.now.year
c = y / 100
n = y - 19 * ( y / 19 )
k = ( c - 17 ) / 25
i = c - c / 4 - ( c - k ) / 3 + 19 * n + 15
i = i - 30 * ( i / 30 )
i = i - ( i / 28 ) * ( 1 - ( i / 28 ) * ( 29 / ( i + 1 ) ) * ( ( 21 - n ) / 11 ) )
j = y + y / 4 + i + 2 - c + c / 4
j = j - 7 * ( j / 7 )
l = i - j
m = 3 + ( l + 40 ) / 44
d = l + 28 - 31 * ( m / 4 )
Time.gm(y, m, d)
end
@majioa
Copy link

majioa commented Jul 6, 2017

Is that orthodox or catholic Easter calculation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment