UNPKG

@burglekitt/gmt

Version:

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

20 lines (19 loc) 935 B
import { Temporal } from "@js-temporal/polyfill"; import type { FractionalDigit } from "../../types/index.js"; /** * Return the end of the specified date-time `unit` for a given ISO 8601 datetime string. * * - Returns "" for invalid inputs. * * @param value ISO 8601 datetime string * @param unit Temporal.DateUnit | Temporal.TimeUnit to specify the unit for the end * @param optionsArg optional: weekStartsOn ("monday" | "sunday"), fractionalSecondDigits (number) * @returns ISO 8601 string representing the end of the specified unit, or "" on invalid input * * @example endOfDateTime("2024-02-29T12:34:56", "month") // "2024-02-29T23:59:59.999999999" * @example endOfDateTime("invalid-date", "month") // "" */ export declare function endOfDateTime(value: string, unit: Temporal.DateUnit | Temporal.TimeUnit, optionsArg?: { weekStartsOn?: "monday" | "sunday"; fractionalSecondDigits?: FractionalDigit; }): string;