Skip to content

startOfQuarterForUtc

startOfQuarterForUtc(value: string): string
import { startOfQuarterForUtc } from "@northguild/gmt/utc/calculate";

Return the start of the quarter for a given UTC datetime string.

  • Calculates quarter start month: Q1=1, Q2=4, Q3=7, Q4=10.
  • Returns “” for invalid input.
Parameter Type Description
value string ISO UTC datetime string (e.g. “2024-03-15T12:00:00Z”)

ISO UTC datetime string representing the start of the quarter, or “” on invalid input

startOfQuarterForUtc("2024-03-15T12:00:00Z") // "2024-01-01T00:00:00Z"
startOfQuarterForUtc("invalid") // ""

utc/calculate/startOfQuarterForUtc.ts