📅  最后修改于: 2020-10-22 06:23:13             🧑  作者: Mango
MomentJS提供了查询leap年的日期/时间,日期比较,日期验证等方法。本章将详细讨论它们。
下表显示了MomentJS中可用的方法及其用于查询日期的语法-
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-like, moment-like); moment().isBetween(moment-like, moment-like, String); |
Is Daylight Saving Time |
moment().isDST(); |
Is Leap Year |
moment().isLeapYear(); |
Is a Moment |
moment.isMoment(obj); |
Is a Date |
moment.isDate(obj); |