Shota Shota - 2 years ago 164
Javascript Question

moment.js Invalid date when formating a date

I am trying to format the date that is coming from a server, but I am getting an error that date is not valid.

moment("2016-11-31T18:00:00.000+02:00").format('YYYY-MM-DD'); // Invalid date

EDIT: I've checked and if the day is 30 not 31 it works, jsfiddle updated


Answer Source

There are only 30 days in November...

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download