components icon indicating copy to clipboard operation
components copied to clipboard

MatDatePicker Invalid Date being changed automatically to valid date

Open devcheetah opened this issue 8 years ago • 3 comments

Bug, feature request, or proposal:

Input manually, 11/31/2018. MatDatePicker is changing it to 12/01/2018

What is the expected behavior?

Date should be invalid.

If there is a quick workaround for this behavior, please let me know.

devcheetah avatar Apr 03 '18 15:04 devcheetah

You can extend the NativeDateAdapter and override the parse() method to output an invalid date in this case (like new Date(null))

julianobrasil avatar Apr 04 '18 16:04 julianobrasil

This is how the native Date object in JS handles it as well. E.g. new Date(2018, 10, 31) will create a date that is the 1st of December 2018.

crisbeto avatar Apr 10 '18 19:04 crisbeto

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.