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

timezone select #743

Merged
merged 4 commits into from
Mar 5, 2018
Merged

timezone select #743

merged 4 commits into from
Mar 5, 2018

Conversation

georgehrke
Copy link
Member

fixes #586

Signed-off-by: Georg Ehrke <developer@georgehrke.com>
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
@georgehrke georgehrke added the 2. developing Work in progress label Feb 26, 2018
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
start: start.toJSDate(),
end: end.toJSDate(),
start: moment(start.toString()),
end: moment(end.toString()),
Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

@georgehrke georgehrke Feb 27, 2018

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx :)

@georgehrke georgehrke added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Feb 26, 2018
@georgehrke georgehrke requested a review from tcitworld February 26, 2018 18:11
@georgehrke georgehrke force-pushed the feature/586/timezone_select branch from e0c3810 to 54c2392 Compare February 27, 2018 19:49
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
@georgehrke georgehrke force-pushed the feature/586/timezone_select branch from 54c2392 to 044a29c Compare February 27, 2018 20:22
@georgehrke
Copy link
Member Author

@tcitworld Did you have time to review this yet? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Let user decide their timezone
2 participants