mourner/suncalc

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

View on GitHub ↗Jump to charts ↓Open shareable report

Summary Information

Updated 55 minutes ago
Added to GitGenius on September 20th, 2026
Created on August 25th, 2011
Open Issues & Pull Requests: 12 (+0)
GitHub issues: Enabled
Number of forks: 440
Total Stargazers: 3,473 (+0)
Total Subscribers: 121 (+0)

Charts & Analytics

Fetching additional details & charts...

Issue Activity (beta)

Open issues: 6
New in 7 days: 0
Closed in 7 days: 0
Avg open age: 3,164 days
Stale 30+ days: 6
Stale 90+ days: 3

Recent activity

Opened in 7 days: 0
Closed in 7 days: 0
Comments in 7 days: 0
Events in 7 days: 0

Top labels

  • feature (16)
  • sun (16)
  • moon (9)
  • bug (4)
  • question (2)
  • needs more info (1)

Most active issues this week

No issue events were indexed in the last 7 days.

Detailed Description

SunCalc is a lightweight JavaScript library for calculating sun and moon positions, sunlight phases, and lunar data for any location and time.

The library solves the problem of accurately computing astronomical events without external dependencies. It calculates sun altitude and azimuth, provides precise times for sunrise, sunset, and twilight phases (civil, nautical, and astronomical), determines moon position and phase, and identifies moonrise and moonset times. The calculations follow formulas from Jean Meeus' Astronomical Algorithms and match the accuracy standards of timeanddate.com and the U.S. Naval Observatory. The library handles edge cases at high latitudes, such as polar days when the sun never sets and polar nights when it never rises.

Developers should choose this tool when building applications that need reliable astronomical calculations without adding dependencies or complexity. It suits projects ranging from photography apps that need golden hour timing to location-based services requiring sunrise and sunset data. The library works in both Node.js and browser environments, installable via npm or usable directly through a CDN. Its tiny footprint and zero dependencies make it suitable for performance-sensitive applications.

The project maintains a focused scope with infrequent updates, suggesting stability in the core calculation logic. Issues and pull requests receive responses, indicating active maintenance despite the minimal change frequency. The codebase remains small and self-contained, with no external dependencies to manage or update.