Permalink
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (14 sloc) 348 Bytes
title version signature
As JSON
2.9.0
moment.duration().toJSON();

When serializing a duration object to JSON, it will be represented as an ISO8601 string.

JSON.stringify({
    postDuration : moment.duration(5, 'm')
}); // '{"postDuration":"PT5M"}'

Invalid durations return Invalid Date as json representation.