A tiny, dependency-free JavaScript library for calculating sun and moon positions, sunlight phases (such as sunrise, sunset, and twilight timings), and lunar phase and illumination for any location and time. Useful for getting altitude and azimuth angles, sunrise and dusk-related times, and moon visibility details like rise and set times.
Project status
- Actively maintained, with recent commits and updates as of mid 2026 (last upstream push 2026-07-11, and updates in 2026-07 and 2026-06).
- Update cadence appears healthy, with a patch update (v2.0.1) roughly three to four weeks after the major rewrite (v2.0.0), indicating an ongoing maintenance and refinement cycle rather than a long pause.
AI summary generated
Recent updates
v2.0.1
v2.0.1 is a patch release focused on correcting moon polar-day/polar-night handling in getMoonTimes. The fix updates how alwaysUp and alwaysDown are determined when there are no rise/set crossings during the day.
v2.0.0
SunCalc v2.0.0 is a precision-focused rewrite that switches the library to an ESM-first distribution and adds bundled TypeScript declarations. The public API behavior is updated for degrees-based outputs (north-based azimuth), apparent altitude (refraction-corrected), and UTC-centric date semantics, including different handling for polar/absent events. The repo also introduces a new build pipeline (rolldown) and a new validation test suite against external ephemerides.
BreakingFeaturesv1.9.0
Release v1.9.0 was published, but no release notes were provided by the publisher. As a result, there is no documented information here about new features, breaking changes, bug fixes, security updates, or required migrations.