MomentJS - Comme JSON

Nous pouvons obtenir l'objet duration au format json. La sortie sera représentée sous la forme d'une chaîne ISO8601.

Syntaxe

moment.duration().toJSON();

Exemple

var d = moment.duration(2, 'weeks').toJSON();

Production