MomentJS - Is Same or After


Advertisements

This method checks if the moment is same or after another moment. It returns true or false.

Syntax

moment().isSameOrAfter(Moment|String|Number|Date|Array);
moment().isSameOrAfter(Moment|String|Number|Date|Array, String);

Example

var issameorafter = moment('2017-10-10').isSameOrAfter('2017-10-09');

Output

isSameOrAfter

We can use the units with isSameOrAfter() and the ones supported are year, month, week , day, hour, minute and second.

Example

var issameorafter = moment('2017-10-10').isSameOrAfter('2017-10-09', 'year');

Output

isSameOrAfter Method

Example

var issameorafter = moment('2017-10-10').isSameOrAfter('2017-10-15', 'day');

Output

isSameOrAfter Day
momentjs_date_queries.htm
Advertisements