@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
13 lines (12 loc) • 631 B
TypeScript
import type { Temporal } from "@js-temporal/polyfill";
/**
* Return the PlainDate for the next/previous occurrence of `dayOfWeek` relative to `date`.
*
* @param date starting PlainDate
* @param dayOfWeek target ISO day of week (1-7)
* @param direction 1 to search forward (next), -1 to search backward (previous)
* @param inclusive when `date` already falls on `dayOfWeek`, return it as-is instead of
* advancing a full week
* @returns PlainDate for the resolved weekday
*/
export declare function advanceToWeekday(date: Temporal.PlainDate, dayOfWeek: number, direction: 1 | -1, inclusive: boolean): Temporal.PlainDate;