Regardless of your religious beliefs, you are probably aware that Easter Sunday
occurs on a sliding scale. This is because Easter is a moveable feast and the
date is determined by a lunisolar calendar.
Originally I was planning to talk about how to calculate the date of Easter in
Javascript. PHP has this one on lock with a baked in function and I’ve discussed
it in the past. I was going to go over the Gauss algorithm and all of that. But
hey, It’s Easter and I’m taking the low road.
If you want to know how to calculate the date of Easter in Javascript, you
really should learn how to search npm. Even with the recent issues, npm
is still the best place to find code to use in your Javascript / Node.js
projects.
Searching for Easter yields a handful of results. Sure quite a few are
related to adding easter eggs to your code, but how many modules do we really
need to calculate the date of Easter?
The answer is two, we only need two. One that calculates the Easter date without
any dependencies and one that uses moment.js
. Both of which are in the top
five of the search results.
Hoppy Easter!