Is Same
This indicates whether the Day.js object is the same as the other supplied date-time.
dayjs().isSame(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.
When including a second parameter, it will match all units equal or larger. Passing in month
will check month
and year
. Passing in day
will check day
, month
, and year
.
dayjs().isSame('2011-01-01', 'year')
Units are case insensitive, and support plural and short forms.