MomentJS - Is Between


Advertisements

This method will return true or false if the moment is between other two moments.

Syntax

moment().isBetween(moment-like, moment-like);
moment().isBetween(moment-like, moment-like, String);

Example

var isbetween = moment('2015-05-01').isBetween('2009-10-19', '2018-10-25');

Output

isBetween

Example

var isbetween = moment('2015-05-01').isBetween('2009-10-19', '2018-10-25', 'year');

Output

isBetween Year

You can use the units year, month, week, day, hour, minute and second along with the method as shown above.

momentjs_date_queries.htm
Advertisements