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.