I am trying to implement my own date format for the shiny new datepicker from material2. According to the documentation, I have to provide my version of MD_DATE_FORMATS:
providers: [ {provide: DateAdapter, useValue: NativeDateAdapter }, {provide: MD_DATE_FORMATS, useValue: MY_DATE_FORMATS }, ],
When I use the default implementation:
export const MD_NATIVE_DATE_FORMATS: MdDateFormats = { parse: { dateInput: null, }, display: { dateInput: {year: 'numeric', month: 'numeric', day: 'numeric'}, monthYearLabel: {year: 'numeric', month: 'short'}, dateA11yLabel: {year: 'numeric', month: 'long', day: 'numeric'}, monthYearA11yLabel: {year: 'numeric', month: 'long'}, } };
I get an error message that enters a date. But what type is it? Documentation says any.
If I try to install some dummy function, I get an error: _dateAdapter.parse is not a function.
function dateInput() { return 'ddd'; } const MY_DATE_FORMATS: MdDateFormats = Object.assign({}, MD_NATIVE_DATE_FORMATS, {parse: dateInput });
How to make it work?
angular angular-material
charlie_pl
source share