UNPKG

@burglekitt/gmt

Version:

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

21 lines (20 loc) 824 B
import { Temporal } from "@js-temporal/polyfill"; import type { FractionalDigit } from "../../types/index.js"; type StartOfTimeUnit = Temporal.TimeUnit | "day"; /** * Return the start of the specified time `unit` for a given ISO 8601 time string. * * - Returns "" for invalid inputs. * * @param value ISO 8601 time string * @param unit StartOfTimeUnit to specify the unit for the start * @param optionsArg optional: fractionalSecondDigits (number) * @returns ISO 8601 string representing the start of the specified unit, or "" on invalid input * * @example startOfTime("12:34:56", "hour") // "12:00:00" * @example startOfTime("invalid", "hour") // "" */ export declare function startOfTime(value: string, unit: StartOfTimeUnit, optionsArg?: { fractionalSecondDigits?: FractionalDigit; }): string; export {};