-
Notifications
You must be signed in to change notification settings - Fork 71.9k
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
profilefunctions calculates time wrong #687
profilefunctions calculates time wrong #687
Comments
@MilosKozak do you have the timezone set in your profile? |
The issue is, we don't know the time zone for the profile if it's not set in the profile and it needs to work for both the server and any client regardless of the client or server time zone. The only way to solve that is to either standardize the profile tz to something (utc?) or set the timezone in the profile.
|
i don't have timezone in profile (no memo found i have to do it). But not fully understand why take care about timezone in profile. You use profile in bolus wizards (to do treatments) and i think we can expect you use bolus wizard next to your child (the same timezone). then we must not use timezones in profile and wizards and simply tell it's 8:00 in current timezone |
The timezone in the profile was just added so we can do time based calculations server side, like the BWP plugin alarms. I think that if the profile timezone isn't set we should default to local time instead of UTC. Server would be wrong, but client should do the right thing most of the time. |
I'll pr a change to default to local time and do a better notification on behavior with missing time zone definition.
|
https://github.com/nightscout/cgm-remote-monitor/blob/dev/lib/profilefunctions.js#L52
for example for time 17:00:00 GMT+2 return value of 15:00:00
i'd suggest calculate seconds from midnight as
var timeAsSecondsFromMidnight = time.getHours() * 60 * 60 + time.getMinutes() * 60 + time.getSeconds();
which returns correct value in current timezone and drop lines 40-51
The text was updated successfully, but these errors were encountered: