@burglekitt/gmt
Version:
Temporal-based date and time utilities with timezone support and polyfill integration
16 lines (15 loc) • 611 B
TypeScript
/**
* Return a string with millisecond precision removed from a PlainDateTime or PlainTime value.
*
* - Truncates to second precision.
* - Accepts both PlainDateTime and PlainTime formats.
* - Returns "" for invalid input.
*
* @param value ISO PlainDateTime or PlainTime string
* @returns ISO string without milliseconds, or "" on invalid input
*
* @example chopMilliseconds("2024-02-29T12:34:56.789") // "2024-02-29T12:34:56"
* @example chopMilliseconds("12:34:56.789") // "12:34:56"
* @example chopMilliseconds("invalid") // ""
*/
export declare function chopMilliseconds(value: string): string;