Skip to content

Datepicker documentation example broken/inconsistent #5461

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

Closed
naktinis opened this issue Jul 1, 2017 · 3 comments
Closed

Datepicker documentation example broken/inconsistent #5461

naktinis opened this issue Jul 1, 2017 · 3 comments
Assignees

Comments

@naktinis
Copy link

naktinis commented Jul 1, 2017

Bug, feature request, or proposal:

Bug

What is the expected behavior?

The datepicker component in the official example should be able to parse the selected date consistently.

What is the current behavior?

Depending on the browser's locale (mine is "en-gb") it sometimes mixes up month and day components. E.g. you select "June 1", then open selector again and now it shows "January 6".

What are the steps to reproduce?

  1. Configure your browser so that new Date().toLocaleString() returns a string in this format 01/07/2017, 14:00:00 (day first).
  2. Open the official example.
  3. Select "June 1"
  4. Open selector again, note that the date became "January 6"

What is the use-case or motivation for changing an existing behavior?

I want to make it clear that this issue is specifically about fixing the documentation/example so it is consistent independent of the browser configuration one uses. I know that there are similar issues where people have problems with their apps, but this is specifically about fixing the documentation.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Tested on Firefox 54.0 with whatever version of Angular/Material that is used in the official documentation.

@crisbeto
Copy link
Member

crisbeto commented Jul 1, 2017

This should be resolved once #5419 gets in.

@mmalerba
Copy link
Contributor

mmalerba commented Jul 5, 2017

The NativeDateAdapter doesn't work well for locales other than en-US. I recommend using a custom DateAdapter or waiting for Angular Material's official MomentDateAdapter which will use Moment.js for parsing and formatting dates.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants