MomentJS - Is a Duration


Advertisements

This method is used to check if the variable is a moment duration object.

Syntax

moment.isDuration(obj);

Example

var d = moment.isDuration(moment.duration(2, 'weeks'));
var st = moment.isDuration(moment());
var s = moment.isDuration(new Date());

Output

JSON Is Duration
momentjs_durations.htm
Advertisements