# parseYearMonthFromDateTime

:::caution[Unreleased]
Not in `@northguild/gmt` 1.20.0 on npm yet. It is on `main` and ships in the next release.
:::

## Signature

```ts
parseYearMonthFromDateTime(value: string): string
```

Return the year-month (`YYYY-MM`) of an ISO 8601 date-time string.

- The day and the time are dropped, so the time never moves the month.
- A `Z` or an offset gives `""`; a time zone annotation with no offset is ignored, as `isValidDateTime` reads it.
- Only the ISO calendar is read.
- Returns "" for invalid input.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | ISO date-time string |

## Returns

The canonical `YYYY-MM` string (`±YYYYYY-MM` outside 0000-9999), or "" on invalid input

## Examples

```ts
import { parseYearMonthFromDateTime } from "@northguild/gmt/plain/parse";

parseYearMonthFromDateTime("2026-10-01T10:00:00") // "2026-10"
```

## Source

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