MomentJS - As JSON



We can get the duration object in json format. The output will be represented as an ISO8601 string.

Syntax

moment.duration().toJSON();

Example

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

Output

JSON
momentjs_durations.htm
Advertisements