# endOfQuarterForZoned

Industry: Core

## Signature

```ts
endOfQuarterForZoned(value: string, optionsArg?: { fractionalSecondDigits?: FractionalDigit; }): string
```

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.
- Returns one nanosecond before the next local quarter starts in `value`'s own zone (see `floorToZone`), so the result is never before `value`: a quarter whose last local hour repeats (`Africa/Cairo`, 2010-09-30) ends with the second pass.
- The end is written at nanosecond precision by default, so the string names the end itself.
- Validation is performed on the input.
- **Compatibility:** before 1.16.0 the default printed no fractional digits, which wrote a moment earlier than the end. Pass `{ fractionalSecondDigits: 0 }` to keep the previous string.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | ISO ZonedDateTime string |

## Options

**optionsArg**

optional setting for the precision of the output string

| Option | Type | Default | Description |
| --- | --- | --- | --- |
| `fractionalSecondDigits?` | `0` \| `1` \| `2` \| `3` \| `4` \| `5` \| `6` \| `7` \| `"auto"` \| `8` \| `9` ([`FractionalDigit`](/gmt/reference/types/FractionalDigit/)) | `9` | The number of fractional-second digits the result is written with, `0` to `9`, or `"auto"` to drop trailing zeros. Fewer than 9 digits truncate the string, as Temporal's `toString` does, so it names a moment before the end. |

## Returns

ISO ZonedDateTime string for the end of the quarter, or "" on invalid input

## Related types

- [`FractionalDigit`](/gmt/reference/types/FractionalDigit/)

## Examples

```ts
import { endOfQuarterForZoned } from "@northguild/gmt/zoned/calculate";

endOfQuarterForZoned("2024-02-15T14:30:00+00:00[UTC]") // "2024-03-31T23:59:59.999999999+00:00[UTC]"
```

## Source

[zoned/calculate/endOfQuarterForZoned.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/zoned/calculate/endOfQuarterForZoned.ts)
