As ISO 8601 String2.8.0+

  1. moment.duration().toISOString();

Returns duration in string as specified by ISO 8601 standard.

  1. moment.duration(1, 'd').toISOString() // "P1D"

Format PnYnMnDTnHnMnS description:

UnitMeaning
PP stands for period. Placed at the start of the duration representation.
YYear
MMonth
DDay
TDesignator that precedes the time components.
HHour
MMinute
SSecond