Estimates the moon phase name and age in days for a given date using the mean synodic month from a cited reference new moon.
Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.
Try it
Inputs
date (string, ISO date (YYYY-MM-DD, taken as 00:00 UTC), required) : Calendar date to evaluate, interpreted at 00:00 UTC.
Outputs
phase (phase name): One of the eight named moon phases.
age (days): Days since the most recent mean new moon, 0 to about 29.53.
Steps
Take a cited reference new moon: 2000-01-06 18:14 UTC (Meeus, Astronomical Algorithms, 2nd ed., chapter 49).
Take the mean synodic month: 29.530588853 days (Meeus, same chapter).
Compute the number of days between the reference new moon and the target date at 00:00 UTC.
Reduce that count modulo the synodic month, wrapping negative results into 0..synodic month, to get the moon's age in days.
Divide the synodic month into 8 named phases at boundaries of 1, 3, 5, 7, 9, 11, 13, and 15 sixteenths of the synodic month, and report the phase whose range contains the age.
Round the reported age to 2 decimal places.
This is a mean-motion approximation, not a full ephemeris; the true phase time can differ from this estimate by up to about half a day because the Moon's actual orbital speed varies.
Constants
synodic_month_days = 29.530588853 days (source: Astronomical Algorithms, 2nd ed., Chapter 49 (Phases of the Moon), p. 349)
reference_new_moon_utc = 2000-01-06T18:14:00Z UTC datetime (source: Astronomical Algorithms, 2nd ed., Chapter 49 (Phases of the Moon), p. 349)
Sources
Astronomical Algorithms, 2nd ed., Chapter 49 (Phases of the Moon), p. 349 (Willmann-Bell, 2026-09-30T19:40:00Z) - Source of the mean synodic month constant and the k=0 reference new moon epoch only. Chapter 49 itself computes the full phase time from about 25 periodic correction terms for roughly 2-minute accuracy against real ephemeris data; that full algorithm is NOT implemented here. This method is the simpler mean-motion approximation (constant period from a single reference epoch), which can be off by up to roughly half a day at points in the synodic cycle.