moment-duration
ISO 8601 duration support for Moment.js.
Examples
Parsing an ISO 8601 duration string:
var oneWeek = moment;var twoDaysThreeHours = moment;var fourSeconds = moment;var allMixed = moment;
The ISO spec for durations doesn't define a millisecond unit, but I consider it useful so added it anyway under the Z
unit.
var twentyMilliseconds = moment;
There's also a helper method to get a duration value in ISO format.
var delay = moment;var isoString = delay; // PT100Z
License
moment-duration is freely distributable under the terms of the MIT license.