# getLargestDateDurationUnit

Industry: Core

## Signature

```ts
getLargestDateDurationUnit(units: ("years" | "months" | "weeks" | "days" | DateUnit)[]): "years" | "months" | "weeks" | "days" | ""
```

Return the largest DateDurationUnit from the provided array.

- Returns the largest unit based on Temporal's unit order: years &gt; months &gt; weeks &gt; days.
- Each unit may be singular or plural (`"day"` or `"days"`), as Temporal accepts; the result is the plural name.
- Returns "" when `units` is not an array, is empty, or holds anything that is not a unit of this family.
- **Compatibility:** before 1.16.0 an empty or invalid `units` returned a default unit (`"days"`).

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `units` | `("years" \| "months" \| "weeks" \| "days" \| DateUnit)[]` | array of DateDurationUnits (singular or plural names) to evaluate |

## Returns

the largest DateDurationUnit found in the array, or "" on invalid input

## Related types

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

## Examples

```ts
import { getLargestDateDurationUnit } from "@northguild/gmt/plain/calculate";

getLargestDateDurationUnit(["months", "days"]) // "months"
```

## Source

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