endOfQuarterForZoned
Signature
Section titled “Signature”endOfQuarterForZoned(value: string, optionsArg?: { disambiguation?: Disambiguation; offset?: Offset; fractionalSecondDigits?: FractionalDigit; }): stringimport { endOfQuarterForZoned } from "@northguild/gmt/zoned/calculate";Return the end of the quarter for a given zoned ISO datetime.
- Calculates which quarter (1-4) the date falls into and returns the last moment of that quarter.
disambiguationcontrols DST gap/overlap resolution when a quarter boundary lands on an ambiguous local time: “compatible” (default, matches Temporal’s default), “earlier”, “later”, or “reject” (throws, resulting in “”).offsetcontrols whether the source’s existing UTC offset is kept when computing a new boundary: “prefer” (Temporal’s own default — keeps the source offset whenever still valid, which makesdisambiguationinert in the (rare) common-zone case since quarter boundaries don’t fall on DST transitions), “use”, “ignore” (this function’s default — always recomputes from time zone + local time, discarding the stale offset; this is what makesdisambiguationactually take effect where a quarter boundary does coincide with a transition), or “reject” (throws if the source offset is invalid for the new fields, independent ofdisambiguation). Leaveoffsetat its default unless you specifically need Temporal’s raw.with()semantics.fractionalSecondDigitscontrols how many fractional seconds are included in the output: 0 (default — no fractional seconds), 3 (milliseconds), 6 (microseconds), or 9 (nanoseconds).- Validation is performed on the input.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value |
string |
ISO ZonedDateTime string |
Options
Section titled “Options”options
| Option | Type | Default |
|---|---|---|
disambiguation? |
Disambiguation |
— |
offset? |
Offset |
— |
fractionalSecondDigits? |
FractionalDigit |
— |
Returns
Section titled “Returns”ISO ZonedDateTime string for the end of the quarter, or “” on invalid input
Related types
Section titled “Related types”Examples
Section titled “Examples”endOfQuarterForZoned("2024-02-15T14:30:00+00:00[UTC]") // "2024-03-31T23:59:59+00:00[UTC]"endOfQuarterForZoned("2024-05-10T10:00:00+00:00[UTC]") // "2024-06-30T23:59:59+00:00[UTC]"endOfQuarterForZoned("2024-11-20T08:00:00+00:00[UTC]") // "2024-12-31T23:59:59+00:00[UTC]"endOfQuarterForZoned("2024-02-15T14:30:00+00:00[UTC]", { fractionalSecondDigits: 9 }) // "2024-03-31T23:59:59.999999999+00:00[UTC]"endOfQuarterForZoned("invalid") // ""