-
Notifications
You must be signed in to change notification settings - Fork 116
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
fix : utcToZonedTime returns next day when time matches offset #43
Conversation
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 have added two tests for this to my master branch which fail even in Chrome 80; with this change the tests then pass. I'm quite happy with it, I just had two questions. I will merge and release today, as soon as I hear from you on those.
}); | ||
|
||
var testDateTimeFormatted = testDateTime.format(new Date("2014-06-25T04:00:00.123Z")) | ||
if(testDateTimeFormatted === '06/25/2014, 00:00:00' || testDateTimeFormatted === '06/25/2014 00:00: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.
@hyyan it doesn't show here, but in my IDE I see strange characters before and after each part of the second date string you are comparing with. What character is this, and is it there intentionally?
I'm also curious why it is possible to have formatted output either with or without the comma? I would have expected only one possibility for a given locale.
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 noticed when using the timezone polyfill for IE11, the date gets formatted without a comma, that's why I added the check, the string which contains hidden characters is copied directly from IE11 console
var testDateTimeFormatted = testDateTime.format(new Date("2014-06-25T04:00:00.123Z")) | ||
if(testDateTimeFormatted === '06/25/2014, 00:00:00' || testDateTimeFormatted === '06/25/2014 00:00:00') { | ||
dtfCache[timeZone] = new Intl.DateTimeFormat('en-US', { | ||
hour12: false, |
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.
Do you know whether IE / Chrome <73 throws an error or warning when hourCycle: undefined
is included? It would be nice to collapse this into a single object. hour12
can be specified next to hourCycle
, so we could have:
hour12: false,
hourCycle: ... ? "h23" : undefined,
...
If you haven't looked at that and don't have the setup to test this easily I will merge it as is though.
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 did not really test it, but most likely it will do
fix #38 , fix #41