1

I am using Moment.js with Angular 8: I am using the following html: But I am getting "mm/dd/yyyy" in the input box but I want "yyyy-mm-dd". In moment.js url it stated it should be "yyyy-mm-dd" by default(https://momentjs.com/docs/).

  <input id="startDate" name="startDate" type="date" [(ngModel)]="report.startDate" required 
#startDate="ngModel"/>

enter image description here enter image description here

Any help or hint would be greatly appreciated it!!

jadeite1000
  • 621
  • 2
  • 11
  • 27

1 Answers1

1

The format keyword will allow you to define how you want the date displayed.

moment().format('YYYY-MM-DD');  
Michaela D
  • 36
  • 4