nextDay
API index · Input types and conventions · Installation
nextDay(value, weekday) → same kind
Move strictly forward to the next occurrence of the requested weekday. If the input already has that weekday, move to the following week. Preserve clock fields with native calendar arithmetic. If an entire weekday occurrence was skipped in a zone, continue to a later occurrence. An unrepresentable result throws.
import { nextDay } from '@frantss/temporal-fns';
const thursday = Temporal.PlainDate.from('2026-10-22');
nextDay(thursday, 5).toString(); // => '2026-10-23'
nextDay(thursday, 4).toString(); // => '2026-10-29'
nextDay(thursday, 0).toString(); // => '2026-10-25'
nextDay(Temporal.PlainDateTime.from('2026-10-22T12:34:56.123456789'), 5).toString(); // => '2026-10-23T12:34:56.123456789'Related: previousDay, addBusinessDays, startOfWeek.
Behaviors: CAL-001: Weekday navigation is strictly next or previous; CAL-002: Date-time navigation preserves the local clock and kind; CAL-003: A missing weekday occurrence is skipped rather than returning another weekday; CAL-004: Weekday numbers cannot wrap or be fractional; CAL-012: Weekday navigation reports an unavailable result at the range limit.