How to change output format of material 2 date-picker

后端 未结 8 1405
無奈伤痛
無奈伤痛 2020-12-16 05:41

I am using angular material 2 Date-Picker component

The only string input it understands is in ISO date format

Ex. \"2017-11-13T10:39:28.300Z\"

But i

8条回答
  •  既然无缘
    2020-12-16 06:05

    The best solution would be to use ControlValueAccessor and make a custom input component, this will have you in control of input and output of the component.

    update:

    Here is the reference implementation using this approach reproduced by Moutaz-homsi

    https://stackblitz.com/edit/angular-dlxnmx?file=app%2Fcva-date.component.ts

提交回复
热议问题