是否之前
这指示 Day.js 对象是否早于提供的其他日期时间。
¥This indicates whether the Day.js object is before the other supplied date-time.
dayjs().isBefore(dayjs('2011-01-01')) // default milliseconds
如果要将粒度限制为毫秒以外的单位,请将其作为第二个参数传递。在这种情况下,比较将考虑给定单位和上述单位。
¥If you want to limit the granularity to a unit other than milliseconds, pass it as the second parameter. In that case, the comparison respects the given unit and the units above.
dayjs().isBefore('2011-01-01', 'month') // compares month and year
单位不区分大小写,并支持复数和缩写形式。
¥Units are case insensitive, and support plural and short forms.