Skip to content

Possible incorrect date for Astronoby::Sun.observation_events.setting_time #97

@trevorturk

Description

@trevorturk

Description

Possible incorrect date for Astronoby::Sun.observation_events.setting_time.

Reproduction Steps

lat = 41.87
lon = -87.62
zone = "America/Chicago" # ActiveSupport::TimeZone
time = "2024-09-11 16:36:50 -0500" # ActiveSupport::TimeWithZone

observer = Astronoby::Observer.new(
  latitude: Astronoby::Angle.from_degrees(lat),
  longitude: Astronoby::Angle.from_degrees(lon),
)

sun = Astronoby::Sun.new(time: time)
events = sun.observation_events(observer: observer)

events.rising_time # 2024-09-11 11:27:07 UTC
events.setting_time # 2024-09-11 00:07:35 UTC (notice this time is before the rising time)

events.rising_time.in_time_zone(zone) # 2024-09-11 06:27:07 -0500
events.setting_time.in_time_zone(zone) # 2024-09-10 19:07:35 -0500 (notice this is the correct time, but one day too early)

Expected behavior

Expect setting_time to be after rising_time on the same date. I tested also with passing in a UTC time, but I believe (from a quick search in the issues) that I should be able to pass in a ActiveSupport::TimeWithZone?

Actual behavior

Actual setting_time is before rising_time on the day before (but is the correct hour/min/sec).

System configuration

astronoby version: astronoby (0.5.0)
ruby version: ruby 3.3.5

Apologies if I'm misunderstanding something -- thank you for the help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions