-
Notifications
You must be signed in to change notification settings - Fork 245
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
timezone select #743
timezone select #743
Conversation
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
start: start.toJSDate(), | ||
end: end.toJSDate(), | ||
start: moment(start.toString()), | ||
end: moment(end.toString()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This small change has actually a big impact. I'm considering doing a 1.6.1 beta before the final release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see right away what it does, I'll check later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It all comes down to one difference:
- the JS date object stores date and time in relation to an offset.
- the string representation just stores date and time.
Let's say your browser's UTC offset is one hour and so is the offset of the timezone you selected: both will work and the event will be displayed correctly.
But let's say your browser's UTC offset is one hour, but you selected New York as your timezone, then you will still see the event with the one hour UTC difference, although you would expect it to be displayed in New York timezone.
That's because when invoking the convertZone method on ICAL.Time
, the offset of the js date object is updated as well.
If you have an js date object like this:
2018-02-27 18:00 UTC+1
converting to New York timezone results in
2018-02-27 12:00 UTC-5
Now your browser wants to display it, but knows you are not in UTC-5 but in UTC+1, so it adds the 6 hours again and you end up with 2018-02-27 18:00
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx :)
e0c3810
to
54c2392
Compare
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
54c2392
to
044a29c
Compare
@tcitworld Did you have time to review this yet? :) |
fixes #586