components icon indicating copy to clipboard operation
components copied to clipboard

Date Picker Reading Incorrect type in Value

Open michaeldev6 opened this issue 8 years ago • 2 comments

Bug, feature request, or proposal:

Typing into the datepicker has the value be read as 1 day less. So 2018-05-31 will be converted to 2018-05-30. It seems to be only with this particular format.

What is the expected behavior?

That the date be the same.

What is the current behavior?

date-picker

What are the steps to reproduce?

go to the example site and type in 2018-05-31 into the "Datepicker selected value" section. https://material.angular.io/components/datepicker/examples

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

So that what is typed in is the actual value

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

Existing one.

michaeldev6 avatar Jun 01 '18 19:06 michaeldev6

The NativeDateAdapter only supports dates in mm/dd/yyyy format due to the limitations of JavaScript's Date parsing. I'd suggest using a different date adapter that supports other formats (e.g. https://www.npmjs.com/package/@angular/material-moment-adapter)

mmalerba avatar May 27 '20 05:05 mmalerba

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.