# isValidYearMonth

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

## Signature

```ts
isValidYearMonth(value: string): boolean
isValidYearMonth(value: void | {} | null | undefined): boolean
isValidYearMonth(value: unknown): value is string
```

Return true if `value` is a valid ISO year-month string: `YYYY-MM` or `±YYYYYY-MM`.

- The part before the first annotation must match `plainYearMonth`: the extended form only (`202610` is refused, as `isValidDate` refuses `20241225`), a four-digit year or a sign and six digits, never `-000000`.
- The range is Temporal's: `-271821-04` to `+275760-09`.
- A date such as `2026-10-01` is not a year-month: use `parseYearMonthFromDate`.
- Reads RFC 9557 annotations as `Temporal.PlainYearMonth.from` does: elective ones (`[foo=bar]`) and a time zone annotation are ignored, and an unknown critical one (`[!foo=bar]`) is rejected.
- The calendar must be `iso8601`, in any case (`[u-ca=ISO8601]` is accepted); any other calendar is refused.
- Rejects a time, a `Z` and an offset.
- A value that is not a string, a `String` object included, returns `false`. A `true` result narrows an `unknown` value to `string`.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `value` | `string` | any value; a string is checked as an ISO year-month |

## Returns

boolean indicating validity

## Examples

```ts
import { isValidYearMonth } from "@northguild/gmt/plain/validate";

isValidYearMonth("2026-10") // true
```

## Source

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