@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
24 lines (23 loc) • 1.03 kB
TypeScript
import type { Temporal } from "@js-temporal/polyfill";
/**
* Return the start of the specified date `unit` for a `Temporal.PlainDate`.
*
* - Always uses Monday as the week start (consistent with roundDate semantics).
* - Does NOT validate the unit — caller ensures it is a DateUnit.
*
* @param source Temporal.PlainDate to round
* @param unit DateUnit to specify the unit for the start
* @returns Temporal.PlainDate at the start of the specified unit
*/
export declare function getStartOfDateUnit(source: Temporal.PlainDate, unit: string): Temporal.PlainDate;
/**
* Add `amount` units of the specified date `unit` to a `Temporal.PlainDate`.
*
* - Does NOT validate the unit — caller ensures it is a DateUnit.
*
* @param date Temporal.PlainDate to advance
* @param unit DateUnit to add
* @param amount number of units to add
* @returns new Temporal.PlainDate advanced by the specified amount
*/
export declare function addDateUnit(date: Temporal.PlainDate, unit: string, amount: number): Temporal.PlainDate;