UNPKG

@burglekitt/gmt

Version:

Temporal-based date and time utilities with timezone support and polyfill integration

18 lines (17 loc) 714 B
import { Temporal } from "@js-temporal/polyfill"; /** * Return the start 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 start * @param optionsArg optional: weekStartsOn ("monday" | "sunday") * @returns ISO 8601 string representing the start of the specified unit, or "" on invalid input * * @example startOfDate("2024-02-29", "month") // "2024-02-01" * @example startOfDate("invalid-date", "month") // "" */ export declare function startOfDate(value: string, unit: Temporal.DateUnit, optionsArg?: { weekStartsOn?: "monday" | "sunday"; }): string;