Repository

mourner/suncalc

SunCalc

A tiny JavaScript library for calculating sun/moon positions and phases.

3.5kstars

Open github.com

mourner/suncalc

SunCalc

A tiny, dependency-free JavaScript library for calculating sun/moon positions, sunlight phases, moon phases, and rise/set times for any location and time.

Visit project

Show me a random project

First shared
Jun 18, 2026
HN activity
30

Show HN@mournerJun 18, 2026

Show HN: SunCalc v2 – a tiny JavaScript library for sun and moon calculations

SunCalc is one of my first open source projects — made the first commit 15 years ago and it had its share of wonderful uses ever since, but it's been somewhat neglected in recent years. Now that modern AI tools give me the ability to catch up on years of accumulated tech debt and user issues, I finally have the capacity to revive projects like this and keep them in excellent shape. v2 is a new version that improves the calculations accuracy by 5x for the Sun and by 20x for the Moon, verified by an extensive test harness vs ground truth from US Naval Observatory, in addition to fixing a ton of issues and modernizing the distribution with ESM. Hope you enjoy it.

Community

Hacker News discussion

Loading the thread…