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

[DatePicker] Now the date passed to DateTimeFormat is always in UTC #7056

Merged

Conversation

JustAndrei
Copy link

Intl.DateTimeFormat is too smart: it takes into account historical changes in calendars. For instance, configure DatePicker to use Intl.DateTimeFormat (for internationalization) and try to select any date in March 2011. You'll see there are many bugs in calendar at that month, and the only reason is that Intl.DateTimeFormat is aware of that Europe started DST in March 2011.
This can easily be fixed if to make sure that

  1. The Intl.DateTimeFormat instance is configured for the UTC time zone,
  2. The date passed to the format function is UTC itself.
    This way there are no surprises.

@JustAndrei JustAndrei changed the title Now the date passed to DateTimeFormat is always in UTC [DatePicker] Now the date passed to DateTimeFormat is always in UTC Jun 4, 2017
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

Two pieces of documentation I have used to check that PR DateTimeFormat and Date.UTC. That looks good to me. It would be awesome with a unit test on the new dateUTC helper.

@oliviertassinari oliviertassinari added component: date picker This is the name of the generic UI component, not the React module! bug 🐛 Something doesn't work labels Jun 5, 2017
@oliviertassinari oliviertassinari merged commit 9a6f0dd into mui:master Jun 6, 2017
@oliviertassinari
Copy link
Member

@JustAndrei Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: date picker This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants