Computing All 13 New Moons of 2027 in Python & Pure JS (Zero Runtime Dependencies)
In my last post about rebuilding Eastman Kodak's 1928–1989 13-month calendar for 2027, several readers asked about an unexpected astronomical coincidence: why does 2027 have 13 New Moons, and how do you compute lunar ill
In my last post about rebuilding Eastman Kodak's 1928–1989 13-month calendar for 2027, several readers asked about an unexpected astronomical coincidence: why does 2027 have 13 New Moons, and how do you compute lunar illumination accurately in a static browser app without shipping a 500 KB ephemeris library?
Here is the exact pipeline I used for SOL-2027 — combining PyEphem / Jean Meeus UTC tables at build time with a tiny O(1) lookup and cosine phase interpolator in pure JavaScript.
Why Gregorian August 2027 Collides — and a 13×28 Calendar Doesn't
A synodic lunar month averages 29.530588 days, which means a 365-day solar year spans ~12.368 lunar cycles. Most years squeeze 12 New Moons across 12 uneven Gregorian months, occasionally forcing a "Black Moon" (two New Moons in one Gregorian month).
In 2027, the very first New Moon hits early (Jan 7, 20:25 UTC), leaving just enough room for a 13th New Moon on Dec 27, 20:13 UTC. On the Gregorian calendar, August 2027 gets crammed with two New Moons (Aug 2 and Aug 31).
When you project those exact same 13 UTC instants onto Moses Cotsworth's 13-month × 28-day International Fixed Calendar (where Month 07 SOL runs June 18 – July 15 around the Summer Solstice):
-
01 · January (Jan 1–28):
Jan 7 · 20:25 UTC(Day 7) -
02 · February (Jan 29–Feb 25):
Feb 6 · 15:57 UTC(Day 9) -
03 · March (Feb 26–Mar 25):
Mar 8 · 09:30 UTC(Day 11) -
04 · April (Mar 26–Apr 22):
Apr 6 · 23:52 UTC(Day 12) -
05 · May (Apr 23–May 20):
May 6 · 10:59 UTC(Day 14) -
06 · June (May 21–Jun 17):
Jun 4 · 19:41 UTC(Day 15) -
07 · SOL (Jun 18–Jul 15):
Jul 4 · 03:03 UTC(Day 17) -
08 · July (Jul 16–Aug 12):
Aug 2 · 10:06 UTC(Day 18) -
09 · August (Aug 13–Sep 9):
Aug 31 · 17:42 UTC(Day 19) -
10 · September (Sep 10–Oct 7):
Sep 30 · 02:37 UTC(Day 21) -
11 · October (Oct 8–Nov 4):
Oct 29 · 13:37 UTC(Day 22) -
12 · November (Nov 5–Dec 2):
Nov 28 · 03:25 UTC(Day 24) -
13 · December (Dec 3–Dec 30):
Dec 27 · 20:13 UTC(Day 25)
Zero skipped months. Zero double-moon collisions. Each New Moon advances smoothly by ~1.5 days across the 28-day grid from Day 7 in January to Day 25 in December.
Precomputing Exact Brackets for Zero-Dependency Runtime Math
Instead of bundling a heavy orbital mechanics library into the client, I precomputed the 13 exact 2027 UTC New Moon timestamps plus two boundary anchors (Dec 9, 2026 00:52 UTC and Jan 26, 2028 15:12 UTC) so Jan 1–6 and Dec 28–31 never lose edge accuracy:
const PREV_NEW_MOON_2026_MS = Date.UTC(2026, 11, 9, 0, 52);
const NEXT_NEW_MOON_2028_MS = Date.UTC(2028, 0, 26, 15, 12);
const ALL_NEW_MOON_BRACKETS = [
PREV_NEW_MOON_2026_MS,
...NEW_MOONS_2027.map((m) => m.utcMs),
NEXT_NEW_MOON_2028_MS
];
At runtime, finding the lunar cycle progress and illuminated fraction for any day in 2027 takes ~12 lines of pure JS:
const noonMs = Date.UTC(2027, month - 1, day, 12, 0, 0);
let prevMs = ALL_NEW_MOON_BRACKETS[0];
let nextMs = ALL_NEW_MOON_BRACKETS[1];
for (let i = 0; i < ALL_NEW_MOON_BRACKETS.length - 1; i++) {
if (noonMs >= ALL_NEW_MOON_BRACKETS[i] && noonMs < ALL_NEW_MOON_BRACKETS[i + 1]) {
prevMs = ALL_NEW_MOON_BRACKETS[i];
nextMs = ALL_NEW_MOON_BRACKETS[i + 1];
break;
}
}
const cycleProgress = (noonMs - prevMs) / (nextMs - prevMs); // 0 = New, 0.5 = Full
const illumination = Math.round(((1 - Math.cos(2 * Math.PI * cycleProgress)) / 2) * 100);
Because each lunation is bracketed by its actual variable synodic length (which fluctuates between ~29.27 and ~29.83 days due to lunar orbital eccentricity) rather than a naive constant 29.53, this tiny routine stays tightly synced with real New & Full Moon dates all year long while adding < 1 KB gzipped.
Explore the Full 2027 Lunar & Fixed Calendar Tool
If you want to inspect the live UTC table, check what moon phase lands on your 2027 birthday, or see the archival print & gift editions:
- 2027 Thirteen Moons & Cycle Guide: https://sol-2027.vercel.app/moons
- Interactive Birthday Converter & 13×28 Matrix: https://sol-2027.vercel.app
- 2027 Archival Wall Prints & Holiday Gift Guide: https://sol-2027.vercel.app/gifts
Have you ever used precomputed ephemeris brackets instead of runtime astronomy packages in client apps? Would love to hear how you handle timezone/UTC edge cases!
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.