這表示 Day.js 物件是否在提供的另一個日期時間之前。 dayjs().isBefore(dayjs('2011-01-01')) // default milliseconds 如果你想將粒度限制在毫秒以外的單位,請將其作為第二個參數傳遞。在這種情況下,比較會遵循給定的單位和上面的單位。 dayjs().isBefore('2011-01-01', 'month') // compares month and year 單位不區分大小寫,並支援複數和簡短形式。 所有可用單位的清單