问题描述
解析:{dateInput: 'DD.MM.YYYY',},展示: {dateInput: 'DD.MM.YYYY',monthYearLabel: 'MMM YYYY',dateA11yLabel: 'LL',monthYearA11yLabel: 'MMMM-YYYY',},
with
parse.dateInput
:您可以让用户以任何格式输入任何类型的日期,日期适配器会将其重新格式化为您在此属性中指定的格式使用
display.dateInput
可以指定输入日期格式(标有1)display.monthYearLabel
可以指定标有2的区域
不幸的是,我仍然不知道其余的!
Material example for customizing-the-parse-and-display-formats for date picker uses custom MAT_DATE_FORMATS
export const MY_FORMATS = {
parse: {
dateInput: 'LL',
},
display: {
dateInput: 'LL',
monthYearLabel: 'MMM YYYY',
dateA11yLabel: 'LL',
monthYearA11yLabel: 'MMMM YYYY',
},
};
I could not find where and how these fields like dateA11yLabel
will come into play. What I could figure out was display.dateInput
is used in displaying selected date on calendar and display.monthYearLabel
is used in the select drop-down of year selector.
- Where are rest of the fields used?
- When writing custom MAT_DATE_FORMATS is it mandatory to define allfields?
Well, I figured out the following:
parse: {
dateInput: 'DD.MM.YYYY',
},
display: {
dateInput: 'DD.MM.YYYY',
monthYearLabel: 'MMM YYYY',
dateA11yLabel: 'LL',
monthYearA11yLabel: 'MMMM-YYYY',
},
with
parse.dateInput
: you can let the user enter any type of date with any format, and the date adapter will reformat it to the format you specify in this attributewith
display.dateInput
you can specify the input date format (marked with 1)display.monthYearLabel
you can specify the area marked with 2
unfortunately, I still don't know about the rest!
这篇关于MAT_DATE_FORMATS 字段的定义/含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!