mourner/suncalc
A tiny JavaScript library for calculating sun/moon positions and phases. observed · 2026-08-28
Health v2 · maintenance only
94/100
- Activity 92
- Release rhythm 92
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-02. Adoption (stars, forks) is never an input.
- gap_med: 23
- age_days: 5487
- days_rel: 53
- days_push: 53
- n_releases_24m: 2
Adoption not part of the score
3463 stars · 440 forks observed · 2026-08-28
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-29, confidence not recorded
SunCalc is a tiny, dependency-free JavaScript library for calculating sun position, sunlight phases (sunrise, sunset, dusk), moon position, moonrise/moonset times, and lunar phase for any location and time. Its calculations are based on Jean Meeus' Astronomical Algorithms and match the accuracy of timeanddate.com and the U.S. Naval Observatory.
Use cases
- calculate sunrise and sunset times for a location
- get sun azimuth and altitude for photography planning
- compute moon phase and moonrise times
- determine twilight and dusk times for a given date and coordinates
- add day/night lighting calculations to a web app or game
When to choose
- you need lightweight, dependency-free sun/moon calculations in JavaScript
- you want accuracy matching timeanddate.com or the U.S. Naval Observatory
- you need both browser and Node.js support with a simple API
When to avoid
- you need high-precision ephemeris-grade astronomical data
- you need calculations for planets, stars, or other celestial bodies
- you work outside JavaScript
Facets
library · maturity stable
math sdk astronomy cross-platform browser sun-position moon-phase sunrise-sunset astronomical-calculations dependency-free algorithms javascript nodejs
2 sources
- readme: https://github.com/mourner/suncalc · fetched 2026-08-28 · 88c6854b5aec
- registry_npm: https://registry.npmjs.org/suncalc · fetched 2026-08-29 · 26c4d68532db
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| mourner/suncalc | main | 94 |
For agents
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem