# plainYearMonth

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

```ts
const plainYearMonth: RegExp = /^(?:\d{4}|\+\d{6}|-(?!0{6})\d{6})-(?:0[1-9]|1[0-2])$/;
```

RegExp matching an ISO 8601 year-month in the extended form: `YYYY-MM` or `±YYYYYY-MM`.

## Examples

```ts
import { plainYearMonth } from "@northguild/gmt";
```

```ts
plainYearMonth.test("2026-10") // true
plainYearMonth.test("+275760-09") // true
plainYearMonth.test("+999999-12") // true (shape only; outside Temporal's range)
plainYearMonth.test("202610") // false (basic format)
plainYearMonth.test("2026-13") // false (month 13)
plainYearMonth.test("2026-10-01") // false (a full date)
```

## Source

[regex/year-month.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/regex/year-month.ts)
