是否相同或之前
这指示 Day.js 对象是否与另一个提供的日期时间相同或早于另一个提供的日期时间。
This requires the
IsSameOrBefore
plugin to work
dayjs.extend(isSameOrBefore)
dayjs().isSameOrBefore(dayjs('2011-01-01')) // default milliseconds
如果要将粒度限制为毫秒以外的单位,请将其作为第二个参数传递。
dayjs().isSameOrBefore('2011-01-01', 'year')
单位不区分大小写,并支持复数和缩写形式。