Skip to content

Moonrise appears to be nil on certain day, on certain place #101

@vincentneo

Description

@vincentneo

Yet again apologies for opening yet another issue:

This time round it's from a user's complain about missing moonrise time in my app that utilises this library. Apparently on certain day, on certain place, the rise time will go nil.

Specifically, the user said that it occurs in Orefield, PA, US on 4 October 2020. (or 3 depending on timezone), so I checked the response from a piece of code, testing from 3 Oct to 5 Oct:

        let jd = JulianDay(year: 2020, month: 10, day: 04)
        let location = GeographicCoordinates(CLLocation(latitude: 40.635, longitude: -75.584))
        let times = RiseTransitSetTimes(celestialBody: Moon(julianDay: jd), geographicCoordinates: location)
        
        let formatter = DateFormatter()
        formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ"
        formatter.timeZone = TimeZone(abbreviation: "UTC")

        let rise = times.riseTime != nil ? formatter.string(from: times.riseTime!.date) : "nil"
        let transit = times.transitTime != nil ? formatter.string(from: times.transitTime!.date) : "nil"
        let set = times.setTime != nil ? formatter.string(from: times.setTime!.date) : "nil"
        
        print(rise) // nil if day is 04
        print(transit)
        print(set)

and sure enough, 4 Oct has its rise date nil, but 3/5 Oct has results for all three.

I've checked multiple sources:
https://www.timeanddate.com/moon/@z-us-18069
https://www.almanac.com/astronomy/moon-rise-and-set/zipcode/18069/2020-10-04

And it does appear that moon rise time should be valid at that place at that time, so I reckon something's wrong somewhere?

Thank you for taking the time reading this.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions