Reputation: 1814
I'm using moment to convert my JSON date into normal date format but I got 13 days previous date from correct date.
var dt = Moment.utc('2020-01-15T00:00:00').format('d MMM YYYY');
console.log(dt); // console value: 3 Jan 2020
Upvotes: 0
Views: 1724
Reputation: 1
Acc to https://momentjs.com/docs/#/displaying/format/ d while formatting in moment is for day of the week that is (0-6) so in your case it is showing as 3rd day of the week
Upvotes: 0
Reputation: 14365
d
is the format for day of week (0-6). You want D
or DD
for day of month.
Moment docs for format options
Upvotes: 3