# getDaysInYear

Industry: Core

## Signature

```ts
getDaysInYear(value: string): number | null
```

Return the number of days in the calendar year containing `value`.

- 365 for a common year, 366 for a leap year.
- It measures the calendar year that holds the date, not the next 12 months. From 2027-06-15 it returns `365`, while `totalUnitsFromNow({ years: 1 }, "days")` returns `366`: the next 12 months from that date take in 29 February 2028.
- Returns null on invalid input.

## Parameters

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

## Returns

365 or 366, or null on invalid input

## Examples

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

getDaysInYear("2024-06-15") // 366 (leap year)
```

## Source

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