Releases: gregmundy/suncalc
Releases · gregmundy/suncalc
v1.2.0
Fixed
get_timesno longer raisesMath::DomainErrorfor polar latitudes.
Previously, callingget_timesfor any location and date where the sun
did not cross a given altitude (polar day, polar night, or any partial
case) would crash the entire call with an unhandledMath::DomainError
fromMath.acos. This bug has been present since the original 2015
port. Events that don't occur are now reported asnilin the result
hash, mirroring the sparse-result pattern already used by
get_moon_times.
Added
:always_upand:always_downflag keys on theget_timesresult.
When neither sunrise nor sunset occurs, the result hash includes either
:always_up => true(midnight sun — sun above horizon all day) or
:always_down => true(polar night — sun below horizon all day). The
flag is determined from the sun's altitude at solar noon. Other events
in the same call (:solar_noon,:nadir, and twilight boundaries that
do still occur) are returned normally alongside the flag.
v1.1.1
No functional changes to the library. This release validates the GitHub
Actions release pipeline end-to-end after a fix to the .gem artifact
upload step in 1.1.0's release run.
Changed
- Internal: release workflow now builds the gem locally before attaching
it to the GitHub Release page; therubygems/release-gemaction does
not leave the artifact in the working directory after publishing. - Bumped
actions/checkoutto v6 in the CI and Release workflows to
clear the upcoming Node 20 deprecation.
v1.1.0
This release brings the Ruby port back in line with upstream
suncalc.js v1.9.0 and fixes two
correctness bugs that have been present since the original release.
Fixed
- Moon altitude refraction. The atmospheric refraction correction applied
inget_moon_positionused dimensionally inconsistent constants, producing
altitudes that were noticeably wrong near the horizon and a division-by-zero
singularity ath ≈ -0.0890rad. The corrected Meeus formula 16.4 is now
used and inputs below the horizon are clamped, matching upstream behavior. get_moon_timesday boundary. Previously the start-of-day was
constructed withTime.new(...).utc, which interprets components in the
host machine's local timezone before converting to UTC. The day boundary is
now built withTime.utc(...)so results no longer depend on$TZ.
Added
SunCalc.astro_refraction(h)— public helper exposing the corrected
refraction calculation.SunCalc.observer_angle(height)— helper that converts an observer's
elevation in meters to the corresponding horizon-angle correction.SunCalc.get_times(date, lat, lng, height = 0)— optional fourth argument
for observer height in meters. A height of 2000 m, for example, advances
sunrise by roughly ten minutes.SunCalc.get_moon_positionnow returns:parallactic_angle(Meeus formula
14.1) alongside the existing fields.SunCalc.get_moon_times(date, lat, lng, in_utc = true)— optional fourth
argument selects the local timezone for the day boundary when set to
false. Defaults totrueto preserve prior intended behavior.SunCalc.get_moon_illumination—dateis now optional and defaults to
Time.now.
Changed
- Test suite expectations updated to the canonical values produced by upstream
suncalc.js v1.9.0. - Loose
be_within(100000)(≈28 hour) tolerance on moon-times assertions
replaced with a strict ±60 second check. - Development dependencies updated: dropped EOL
bundler ~> 1.7constraint,
bumpedrake ~> 13.0, pinnedrspec ~> 3.13.
Notes
- The
:alwaysUp/:alwaysDownkeys returned byget_moon_timesremain
camelCase for backward compatibility. They will be renamed to:always_up
and:always_downin 2.0.