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

Safari incorrectly defaults to UTC for date-time strings. #45

Closed
mbostock opened this issue Feb 8, 2019 · 0 comments · Fixed by #53
Closed

Safari incorrectly defaults to UTC for date-time strings. #45

mbostock opened this issue Feb 8, 2019 · 0 comments · Fixed by #53

Comments

@mbostock
Copy link
Member

mbostock commented Feb 8, 2019

This is clearly a browser bug (and we don’t generally workaround browser bugs), but it’d be pretty easy to patch this I suspect.

@Fil Fil mentioned this issue Jul 8, 2019
Fil added a commit that referenced this issue Jul 21, 2019
instead of treating `new Date("2018-04-25T11:00")` as a local date, Safari parses it as a UTC date and returns it with the tz difference added. This fix detects the situation by checking TWO local dates (one in winter, one in summer) which should return hour 0, and if one of them is not 0 it's the Safari bug. In that case, and if the date string that is passed is local (no "Z"), we shift it accordingly.

I don't know how to write a node test for this, but the following notebook shows the fix on Safari:
https://observablehq.com/d/7e8b78e5050258ae

Fixes #45
@Fil Fil closed this as completed in #53 Jul 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant