-
Notifications
You must be signed in to change notification settings - Fork 417
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
Different results for getTimes depending on time of date passed in #161
Comments
This issue is not just around 31/dec - 1/jan, look at these these results:
Feb 04:
For feb 05:
|
I don't mind working around whatever causes this strange behavior, but I'd like to know what the expectation is for specifying the date at the target coordinates. I'm writing some silly code to hunt around that would be unnecessary if this was clear. I would expect that specifying 00:00:00 for H:M:S (start of day) would give me the events for today, but I get yesterday instead. So would it be reliable to choose 12:00:00 (noon) as the request time? Will that work worldwide? |
I swithced to meeusJs and added an easier interface: https://github.com/jumpjack/MeeusJsEasy |
Not sure that would make it easier in my case. The results from suncalc are pretty much exactly what I'm looking for; I just have to figure out what to expect. My current workaround is to gather events from yesterday/today/tomorrow, sort them by time, and take the window I need out of that. It's more work than necessary but it doesn't need to get run very often so it's not really a performance issue. |
An example given in the docs is the following:
To me this suggests that it doesn't matter what time of day it is in the Date object passed in - i.e. passing in
new Date('2020-01-01T00:00:00)
ornew Date('2020-01-01T23:59:59')
should give me the same results: the sunlight phases for the date 2020-01-01.I was doing some testing and I always got the same results return if I passed in any time from 00:00:00 to 22:45:12, but somehow if I passed in time at 22:45:13 or after for the same date I got different results. I assume that specific timestamp 22:45:12 depends on the lat/long I pass in so it's different for other coordinates.
To replicate:
and
The results in the latter example are all for 1 day later than the former example.
I'm in GMT +0 so I don't think timezones are affecting this.
Is this behaviour expected?
The text was updated successfully, but these errors were encountered: