md-datepicker: Typed dates being parsed incorrectly in docs sample
My OS/Browser settings are set to UK date formats. Picking dates from the picker displays the dates in a UK format.
When typing a UK date into the date picker, its gets confused about how to interpret the date.
For instance,
- A UK date 23/08/2015 fails validation
- A UK date 12/08/2015 is parsed incorrectly. After opening, the calender shows 8th December 2015.
I'm guessing that is mandatory to set up $mdDateLocaleProvider? If so i guess that the sample in the docs should also do this.
I'm also confused about the date pickers interaction with angular i18n. The documentation for $mdDateLocaleProvider implies an entirely DIY approach regardless of angular i18n. Is that correct?.
You should indeed be using $mdDateLocaleProvider in any real application. The default behavior, which relies on the native JS date parsing/formatting, isn't really appropriate for anything beyond a demo / toy.
Unfortunately, the native JS date parsing isn't locale-aware, which is why it doesn't understand UK dates. You're correct in that $mdDateLocaleProvider is very DIY; the idea was not to tie people into doing i18n via Angular when they may have different existing i18n approaches.
This issue has been closed without resolution.
This issue was specifically about the samples in the documentation behaving incorrectly. Based on your reply, the samples should demonstrate the correct usage of $mdDateLocaleProvider (if for nothing else but to just to make them work). Thank you for clarifying the interaction with Angular i18n but this should not be closed as the samples have not been updated to behave correctly.
Filed #4671 to track demo improvement.