How to calculate Easter Sunday in Javascript

Josh Sherman
1 min read
Software Development JavaScript

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!

Join the Conversation

Good stuff? Want more?

Weekly emails about technology, development, and sometimes sauerkraut.

100% Fresh, Grade A Content, Never Spam.

About Josh

Husband. Father. Pug dad. Musician. Founder of Holiday API, Head of Engineering and Emoji Specialist at Mailshake, and author of the best damn Lorem Ipsum Library for PHP.

Currently Reading

Parasie Eve

Previous Reads

Buy Me a Coffee Become a Sponsor

Related Articles