I'm making a calendar generator in JavaScript. I need the Unix Timestamp for easter day midnight, for a given year. Can anyone tell me how I need to do that (in JavaScript)?
Thanks in advance.
PHP's function can be found here: http://www.php.net/easter_date
Here's an alternative method based on an algorithm that R. Sivaraman adapted for the Gregorian Calendar from an algorithm originally developed by J. Meeus for the Julian calendar (cf. https://en.wikipedia.org/wiki/Computus).
It seems like a more elegant and intuitive solution than the Gauss algorithm which has already been mentioned. At least it shaves off a few steps (only 5 total plus the JS date methods) and uses fewer variables (only 4 total plus the month, date, and year).
For example:
According to this:-
Example usage:-
Here's one implementation. Can't vouch for it's accuracy.
http://users.sa.chariot.net.au/~gmarts/eastalg.htm#easterscript
Have a look at the PHP source code to see how they calculate theirs and replicate in JavaScript?