Reputation: 659
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"/>
Any help or hint would be greatly appreciated it!!
Upvotes: 1
Views: 2449
Reputation: 46
The format keyword will allow you to define how you want the date displayed.
moment().format('YYYY-MM-DD');
Upvotes: 2