isSameOrBefore
Checks if this date occurs at the same time or before another date.
isSameOrBefore()
Checks if this date occurs at the same time or before another date.
Note
When comparing weeks, the weekStartsOn parameter determines how weeks are calculated. For example, if weekStartsOn is 1 (Monday), then a date on Sunday would be considered part of the previous week.
Signature
isSameOrBefore(other: ChronosInput, unit?: TimeUnit, weekStartsOn?: Enumerate<7>): booleanParameters
other: The date to compare against (can be string, Date, orChronosinstance)unit: The granularity for comparison ('year', 'month', 'week', 'day', 'hour', 'minute', 'second')weekStartsOn: (Optional) Which day (0-6, Sunday-Saturday) to consider as the start of the week (default:0/Sunday)
Return Type
boolean - Returns true if the current Chronos date is either:
- Exactly equal to the comparison date at the specified unit level, OR
- Occurs before the comparison date at the specified unit level
Example
playground.ts
Last updated: Wed, Jun 24, 2026 09:04:13AM (UTC)
