Back to browse
GitHub Repository

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

3,371 starsJavaScript

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

by mourner·Jun 18, 2026·1 point·0 comments

AI Analysis

●●SolidCozyDark Horse

15-year-old library revived with 20x moon accuracy verified against US Naval Observatory.

Strengths
  • 5x sun and 20x moon calculation accuracy verified against US Naval Observatory ground truth.
  • Dependency-free tiny library with ESM modernization and extensive test harness.
  • 3.4k stars and proven track record across many production applications over 15 years.
Weaknesses
  • Niche use case limits broader developer adoption beyond astronomy and weather apps.
  • Maintenance revival is valuable but not a novel technical breakthrough.
Category
Target Audience

Frontend developers, astronomy app builders, weather applications

Similar To

SunPosition.js · astronomy-engine · timeanddate.com APIs

Post Description

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.

Similar Projects