MAT_DATE_FORMATS字段的定义/含义 [英] MAT_DATE_FORMATS definition/meaning of fields

查看:250
本文介绍了MAT_DATE_FORMATS字段的定义/含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.


  1. 在哪里使用其余字段?

  2. 编写自定义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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆