UNPKG

@northguild/gmt

Version:

Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.

15 lines • 722 B
/** * Return the start of the quarter for a given UTC datetime string. * * - Calculates quarter start month: Q1=1, Q2=4, Q3=7, Q4=10. * - Resets every time field, including milliseconds, microseconds and nanoseconds. * - Returns "" for invalid input. * * @param value ISO UTC datetime string (e.g. "2024-03-15T12:00:00Z") * @returns ISO UTC datetime string representing the start of the quarter, or "" on invalid input * * @example startOfQuarterForUtc("2024-03-15T12:00:00Z") // "2024-01-01T00:00:00Z" * @example startOfQuarterForUtc("2024-05-15T12:34:56.789Z") // "2024-04-01T00:00:00Z" * @example startOfQuarterForUtc("invalid") // "" */ export declare function startOfQuarterForUtc(value: string): string;