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

profilefunctions calculates time wrong #687

Comments

@MilosKozak
Copy link
Contributor

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

@jasoncalabrese
Copy link
Member

@MilosKozak do you have the timezone set in your profile?

@sulkaharo
Copy link
Member

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.

On 06 Jul 2015, at 21:27, Jason Calabrese notifications@github.com wrote:

@MilosKozak do you have the timezone set in your profile?


Reply to this email directly or view it on GitHub.

@MilosKozak
Copy link
Contributor Author

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

@jasoncalabrese
Copy link
Member

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.

@sulkaharo
Copy link
Member

I'll pr a change to default to local time and do a better notification on behavior with missing time zone definition.

On 07 Jul 2015, at 00:38, Jason Calabrese notifications@github.com wrote:

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.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment