English 中文(简体)
MomentJS - Date Queries
  • 时间:2024-12-22

MomentJS - Date Queries


Previous Page Next Page  

MomentJS provides methods to query the date/time for leap year, date comparison, date vapdation etc. This chapter discusses them in detail.

Methods for Querying Date in MomentJS

The following table shows methods available in MomentJS and their syntax for querying date −

Method Syntax
Is Before

moment().isBefore(Moment|String|Number|Date|Array);

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

Is Same

moment().isSame(Moment|String|Number|Date|Array);

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

Is After

moment().isAfter(Moment|String|Number|Date|Array);

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

Is Same or Before

moment().isSameOrBefore(Moment|String|Number|Date|Array);

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

Is Same or After

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

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

Is Between

moment().isBetween(moment-pke, moment-pke);

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

Is Daypght Saving Time

moment().isDST();

Is Leap Year

moment().isLeapYear();

Is a Moment

moment.isMoment(obj);

Is a Date

moment.isDate(obj);

Advertisements