Shota Shota - 10 days ago 7
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

jsfiddle

Answer

There are only 30 days in November...