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

Bug fix: use hourCycle instead of hour12 #62

Merged
merged 2 commits into from
Aug 10, 2020

Conversation

margaree
Copy link
Contributor

I noticed the following behavior when using formatDateString to parse Tue Feb 27 2018 00:00:00 GMT-0500 (Eastern Standard Time).

In chrome:
Becomes 02/27/2018, 24:00:00 EST (INCORRECT)

In Firefox:
Becomes 02/27/2018, 00:00:00 EST (CORRECT)

This 24hr time was causing dates to appear as the next day (e.g., would be displayed as Feb 28, 2018 12 AM)

I found this thread https://support.google.com/chrome/thread/29828561?hl=en that mentions this and a reply suggest to use hourCycle: h23 and remove hour12, which does seem to fix it in my use case.

@margaree margaree requested a review from dlockhart August 10, 2020 15:17
Copy link
Member

@dlockhart dlockhart left a comment

Choose a reason for hiding this comment

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

Crazy! And introduced in Chrome 80 would mean this bug likely didn't exist when you first wrote this stuff.

@margaree margaree merged commit 834140f into master Aug 10, 2020
@margaree margaree deleted the handleDateTimeFormatFormatterBug branch August 10, 2020 15:40
@ghost
Copy link

ghost commented Aug 10, 2020

🎉 This PR is included in version 3.0.10 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ghost ghost added the released label Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants