Is a Moment1.5.0+
moment.isMoment(obj);
To check if a variable is a moment object, use moment.isMoment()
.
moment.isMoment() // false
moment.isMoment(new Date()) // false
moment.isMoment(moment()) // true
From version 2.11.0, you can also test for a moment object by instanceof
operator:
moment() instanceof moment // true
当前内容版权归 momentjs.com 或其关联方所有,如需对内容或内容相关联开源项目进行关注与资助,请访问 momentjs.com .