Skip to content

@jsvision/ui / addDays

Function: addDays()

addDays(date, n): CalendarDate

Defined in: ui/src/date/calendar-date.ts:138

Add n days (may be negative); rolls across month and year boundaries.

Parameters

date

CalendarDate

The civil date.

n

number

Days to add (negative to subtract).

Returns

CalendarDate

A fresh, valid CalendarDate.

Example

ts
addDays({ year: 2026, month: 1, day: 31 }, 1);  // { year: 2026, month: 2, day: 1 }
addDays({ year: 2026, month: 3, day: 1 }, -1);  // { year: 2026, month: 2, day: 28 }