Back to Explore

mourner/suncalc

GitHub
5 updates · last 90 daysOpen source

Last release:

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: The repo shows frequent recent updates in 2026, with the last upstream push on 2026-10-05, and follow-on updates published within days.
  • Update cadence: Recent updates cluster closely (for example, 2026-10-01 then 2026-10-05), with longer but still regular gaps after that (about a month from 2026-09-02 to 2026-10-01).

AI summary generated

AI-generated from public sources. May be inaccurate. Report

Recent updates

  • v2.1.3

    Version 2.1.3 fixes `getTimes` results for civil-day offsets and corrects polar-day reporting when sunset occurs as the midnight sun ends. The code updates event selection across neighboring solar days, adds regression tests, and documents a rare duplicate-event case.

  • v2.1.2

    v2.1.2 fixes inaccurate solar event times when the Sun only narrowly reaches a requested altitude. Events are now solved within the appropriate half-day or returned as null when they do not occur, including the single sunrise or sunset on the boundaries of midnight sun or polar night.

  • v2.1.1

    v2.1.1 includes a fix for the Moon illumination `phase` value returned by `getMoonIllumination`, addressing incorrect phase labeling (issue #190). The implementation changes how `phase` is derived, and adds a regression test dataset to verify phase instants.

  • v2.1.0

    v2.1.0 adds an optional utcOffset parameter to both getTimes and getMoonTimes, allowing callers to anchor results to a specific civil day (minutes east of UTC). It also updates getMoonTimes to return additional moon meridian event times (transit and lowerTransit) and aligns its day window with getTimes. The release notes describe both the new API surface and the changed default day behavior for getMoonTimes.

    BreakingFeatures
  • v2.0.2

    v2.0.2 is a targeted fix for getTimes returning events on the wrong day near the antimeridian (issue #187). The change adjusts the internal day-anchoring math used to compute solar transit/rise/set times, and adds a regression test covering multiple longitudes around +/-180 degrees.

  • 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.

    BreakingFeatures
  • v1.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.