previous
Returns a new Chronos instance moved back by specified time unit.
previous()
Returns a new Chronos instance moved back by the specified time unit.
specified
Signature
previous(unit?: TimeUnit): ChronosParameters
| Parameter | Type | Default | Description |
|---|---|---|---|
unit | TimeUnit | 'day' | The time unit to move back by. |
Return Value
Returns a new Chronos instance moved back by one of the specified unit.
Behavior
Moves the date/time backward by exactly the specified unit while preserving other components whenever possible.
Notes
- Returns a new immutable instance.
- Equivalent to
add(-1, unit). - Preserves the existing time components whenever possible.
- Handles month and year overflow automatically.
Examples
playground.ts
Last updated: Fri, Jun 19, 2026 07:09:51PM (UTC)
