I just discovered the `easter_date()` PHP function 🤦‍♂️

How did it not come up in my searches?

It's not all for naught, though, because mine is accurate for the rest of the century, but `easter_date()` is not defined for years after 1937 on 32-bit machines.

nostr:nevent1qqs080eg5f0gnhq9vvpal6ad0g2qnyt6yl0lgzr092feaqrnxttz0kspz4mhxue69uhhyetvv9ujuerpd46hxtnfduhsygy6ftx7h9u9vh38fyxu5ewg860k2az74mqangzqtffdrxxpfzv38vpsgqqqqqqsvr57xa

Reply to this note

Please Login to reply.

Discussion

Do you actually calculate the orbits of the earth and the moon?

Integer math (in seconds).

I used the solar year × years since 1970 + spring equinox offset + moon phase on Jan 1 1970, less it's modulus by the lunar period, plus a lunar period (this acts like `ceil()` for larger-than-1 intervals). This is the first full moon on or after the spring equinox. Sometimes (*in 2038, especially), this result is too early, so we add a lunar period if this is less than 81 days since the new year. Then, modulus by week and add four days. This is Easter Sunday.

I have some other offsets in there, too, since it's defined by liturgical day, not midnight.

*funny that the built-in PHP function fails on exactly that year.