I am trying to format the input from the Angular material datepicker.
For example when the user types 2,3,2018 and press enter, the date is set to this: 2/3/2018. The problem is, that datepicker take the value in the form of an id, for example for 2/3/2018 it uses the id 1517608800000
. I can format the value in the compoment like this using Moment.js like this:
this.value.format('MM/DD/YYYY')
And it formats the code correctly, but it does not apply it back to the input. In the view the value is bound with ngModel
.