MAT_DATE_FORMATS字段的定义/含义 [英] MAT_DATE_FORMATS definition/meaning of fields
问题描述
customizing-the-parse的材料示例日期显示器的-and-display-formats 使用自定义MAT_DATE_FORMATS
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',
},
};
我找不到这些字段的位置和方式,例如 dateA11yLabel
将起作用。我能弄清楚的是 display.dateInput
用于显示日历上的选定日期,而 display.monthYearLabel
用于显示日历中的选定日期。
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.
- 在哪里使用其余字段?
- 编写自定义MAT_DATE_FORMATS时是否必须定义所有
字段?
推荐答案
好,我发现了以下内容:
Well, I figured out the following:
< img src = https://i.stack.imgur.com/bXoyZ.png alt = datepicker>
parse: {
dateInput: 'DD.MM.YYYY',
},
display: {
dateInput: 'DD.MM.YYYY',
monthYearLabel: 'MMM YYYY',
dateA11yLabel: 'LL',
monthYearA11yLabel: 'MMMM-YYYY',
},
-
具有
parse.dateInput
:您可以让用户输入任何类型的日期以及垫,日期适配器会将其重新格式化为您在此属性中指定的格式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 attribute,并带有
display.dateInput
您可以指定输入日期格式(标记为1)with
display.dateInput
you can specify the input date format (marked with 1)display.monthYearLabel
指定标有2的区域不幸的是,我仍然不知道其余部分!
unfortunately, I still don't know about the rest!
这篇关于MAT_DATE_FORMATS字段的定义/含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!