Skip to content

v1.1.0

Choose a tag to compare

@gregmundy gregmundy released this 03 May 05:15
· 4 commits to main since this release

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
    in get_moon_position used dimensionally inconsistent constants, producing
    altitudes that were noticeably wrong near the horizon and a division-by-zero
    singularity at h ≈ -0.0890 rad. The corrected Meeus formula 16.4 is now
    used and inputs below the horizon are clamped, matching upstream behavior.
  • get_moon_times day boundary. Previously the start-of-day was
    constructed with Time.new(...).utc, which interprets components in the
    host machine's local timezone before converting to UTC. The day boundary is
    now built with Time.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_position now 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 to true to preserve prior intended behavior.
  • SunCalc.get_moon_illuminationdate is 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.7 constraint,
    bumped rake ~> 13.0, pinned rspec ~> 3.13.

Notes

  • The :alwaysUp / :alwaysDown keys returned by get_moon_times remain
    camelCase for backward compatibility. They will be renamed to :always_up
    and :always_down in 2.0.