Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SunCalc.getMoonTimes returns undefined when today's moon rise was yesterday #163

Open
leonidhtc opened this issue Nov 17, 2022 · 1 comment

Comments

@leonidhtc
Copy link

if (rise) result.rise = hoursLater(t, rise);

Today Thu Nov 17 2022 21:23:39 GMT+0300 (Moscow Standard Time) in Moscow lat = 55.8215625, lng = 37.3774375
the function SunCalc.getMoonTimes returns undefined because rise = undefined.
Today's moon rise was yesterday.
See the screenshot.
rise-undefined

@leonidhtc leonidhtc changed the title result returns Undefined SunCalc.getMoonTimes returns undefined when today's moon rise was yesterday Nov 17, 2022
@Phoscur
Copy link

Phoscur commented Jun 11, 2024

Types also miss to reflect this, either rise or set attributes may be missing if it happens on another day:

export interface GetMoonTimes {
    rise: Date; // actually optional
    set: Date; // actually optional
    alwaysUp?: true;
    alwaysDown?: true;
}

Example:

10.7.2024 12:00 Berlin/Europe
{ rise: 2024-07-10T08:11:47.515Z }

But the next day, I find the alignment I'm looking for?:

11.7.2024 12:00 Berlin/Europe
{ rise: 2024-07-11T09:19:42.301Z, set: 2024-07-10T22:01:34.456Z }

Sunset: 11.7.2024, 21:30:20
Moonset: 11.7.2024, 00:01:34

I should get the moonset in the first query for the 10th, why not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants