@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
18 lines (17 loc) • 702 B
TypeScript
import { Temporal } from "@js-temporal/polyfill";
/**
* Return the end of the specified date `unit` for a given ISO 8601 date string.
*
* - Returns "" for invalid inputs.
*
* @param value ISO 8601 date string
* @param unit Temporal.DateUnit to specify the unit for the end
* @param optionsArg optional: weekStartsOn ("monday" | "sunday")
* @returns ISO 8601 string representing the end of the specified unit, or "" on invalid input
*
* @example endOfDate("2024-02-29", "month") // "2024-02-29"
* @example endOfDate("invalid-date", "month") // ""
*/
export declare function endOfDate(value: string, unit: Temporal.DateUnit, optionsArg?: {
weekStartsOn?: "monday" | "sunday";
}): string;