Date.isBeforeOrEqual
$date.isBeforeOrEqual($otherDate) -> boolean
Description
Return true
is Date object is before or equal to $otherDate
.
$otherDate
can be one of the following:
- Date object
- Date string (e.g. “2021-10-17”, “now”, “3 days ago”). See Date Strings.
- Unix timestamp (integer)
$now = Date.now() $lastWeek = $now.add('-7 days') $nextWeek = $now.add('7 days') $lastWeek.isBeforeOrEqual($now) //= true $nextWeek.isBeforeOrEqual('tomorrow') //= false