compareMonthDays
Signature
Section titled “Signature”compareMonthDays(a: string, b: string): number | nullCompare two month-day strings (--MM-DD, or MM-DD) in calendar order: month first, then day.
- Accepts both input forms, so
12-25and--12-25compare equal. - The year is not part of a month-day:
--02-29sorts between--02-28and--03-01. (Temporal has noPlainMonthDay.compare; this compares the matchingPlainDates in the leap reference year 1972, as the note onPlainMonthDay.prototype.valueOfdirects.) - Returns
nullif either input is invalid or not in the ISO calendar.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
a | string | month-day string |
b | string | month-day string |
Returns
Section titled “Returns”-1, 0, or 1, or null on invalid input
Examples
Section titled “Examples”import { compareMonthDays } from "@northguild/gmt/plain/compare";
compareMonthDays("--01-01", "--12-31") // -1Source
Section titled “Source”Code examples: MIT-0. Packages: MIT. Third-party data and components: their own licences, credited where they appear. Everything else:© 2026 NorthGuild, all rights reserved.