startOfQuarterForUtc
Signature
Section titled “Signature”startOfQuarterForUtc(value: string): stringReturn 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.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | ISO UTC datetime string (e.g. “2024-03-15T12:00:00Z”) |
Returns
Section titled “Returns”ISO UTC datetime string representing the start of the quarter, or "" on invalid input
Examples
Section titled “Examples”import { startOfQuarterForUtc } from "@northguild/gmt/utc/calculate";
startOfQuarterForUtc("2024-03-15T12:00:00Z") // "2024-01-01T00:00:00Z"