witchcraft.boo

Moon phase

Enter a date and get the phase, using the same synodic-month arithmetic almanacs have used for a very long time.

How it works

The synodic month, from one new moon to the next, averages 29.53059 days. Take the number of days between your date and a known new moon, divide by that figure, and the fractional remainder tells you how far through the cycle you are. Zero is new, half is full.

The average is doing a lot of work here. The real interval varies by up to thirteen hours either side because the Moon's orbit is elliptical and the Sun perturbs it, so this method can be a few hours out. For picking a date to stand in a field, it is entirely sufficient.

The eight phases