How do I format a date as ISO 8601 in moment.js?

This docs mention moment.ISO_8601 as a formatting option (from 2.7.0 – http://momentjs.com/docs/#/parsing/special-formats/), but neither of these work (even 2.7.0):

var date = moment();
date.format(moment.ISO_8601); // error
moment.format(date, moment.ISO_8601); // error

(http://jsfiddle.net/b3d6uy05/1/)

How can I get an ISO 8601 from moment.js?

9 Answers
9

Leave a Comment