# compareMonthDays

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

## Signature

```ts
compareMonthDays(a: string, b: string): number | null
```

Compare two month-day strings (`--MM-DD`, or `MM-DD`) in calendar order: month first, then day.

- Accepts both input forms, so `12-25` and `--12-25` compare equal.
- The year is not part of a month-day: `--02-29` sorts between `--02-28` and `--03-01`. (Temporal has no `PlainMonthDay.compare`; this compares the matching `PlainDate`s in the leap reference year 1972, as the note on `PlainMonthDay.prototype.valueOf` directs.)
- Returns `null` if either input is invalid or not in the ISO calendar.

## Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `a` | `string` | month-day string |
| `b` | `string` | month-day string |

## Returns

-1, 0, or 1, or null on invalid input

## Examples

```ts
import { compareMonthDays } from "@northguild/gmt/plain/compare";

compareMonthDays("--01-01", "--12-31") // -1
```

## Source

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