add
Returns a new Chronos instance with the specified unit added.
add()
Returns a new Chronos instance with the specified unit added.
Signatures
add(value: number, unit: TimeUnit): Chronos
add(units: UnitWithValue): ChronosParameters
Parameter 1
value: Number of units to addunits: An object specifying which time units to add. At least one unit-value pair is required.
Parameter 2
unit: Time unit to add ('year', 'month', 'day', etc.)
Return Type
Chronos - New instance with added time
Notes
- Returns new immutable instance
- Handles month/year overflow automatically
Example
playground.ts
Important Note for UnitWithValue
- All properties are optional, but at least one must be provided. Values accept both
numberand numericstringtypes (Numeric). - For more details, refer to addDate which returns
Dateobject and is used internally
Alternatives
- You can also use one/all of these methods as per your need, they're self-explanatory:
Last updated: Mon, Jun 15, 2026 06:37:26PM (UTC)
