tiempo

addWeeks

Add weeks to a datetime

Add weeks to a datetime.

Signature

function addWeeks(
  input: Temporal.Instant | Temporal.ZonedDateTime,
  weeks: number
): Temporal.ZonedDateTime

Parameters

ParameterTypeDescription
inputTemporal.Instant | Temporal.ZonedDateTimeThe datetime to add weeks to
weeksnumberNumber of weeks to add (can be negative)

Returns

A Temporal.ZonedDateTime with the weeks added.

Examples

import { addWeeks } from '@gobrand/tiempo';

const instant = Temporal.Instant.from('2025-01-20T12:00:00Z');
addWeeks(instant, 2);
// 2025-02-03T12:00:00Z[UTC]

On this page