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

getMoonTimes in UTC doesn't set the time correctly #147

Open
kostebudinoski opened this issue Jul 21, 2020 · 0 comments
Open

getMoonTimes in UTC doesn't set the time correctly #147

kostebudinoski opened this issue Jul 21, 2020 · 0 comments

Comments

@kostebudinoski
Copy link

I just noticed that setting the inUTC parameter in the getMoonTimes method to true, results to incorrect time, which leads to wrong set/rise results.

As an example:

SunCalc.getMoonTimes(new Date(2020,4,13,12,16,0), 48.2026, 16.3684, true)

results to invalid rise parameter:

rise: null
set: Wed May 13 2020 10:37:56 GMT+0200

Shouldn't be the time set (when inUTC parameter is true) as following:

t = new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate(), 0, 0, 0);

instead of:

t.setUTCHours(0, 0, 0, 0); which still gets the offset into consideration and outputs wrong resuls? Or I am doing something wrong

Doing it as I mentioned above I get following hopefully correct results:

rise: Wed May 13 2020 01:41:10 GMT+0200
set: Wed May 13 2020 10:37:56 GMT+0200 
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

1 participant