isValidMonthDay
Signature
Section titled “Signature”isValidMonthDay(value: string): booleanisValidMonthDay(value: void | {} | null | undefined): booleanisValidMonthDay(value: unknown): value is stringReturn true if value is a valid ISO month-day string: --MM-DD or MM-DD.
- The part before the first annotation must match
plainMonthDay: the extended form only (--1225and1225are refused, asisValidDaterefuses20241225), with a day that exists in at least one year.--02-29is valid;--02-30and--04-31are not. - Reads RFC 9557 annotations as
Temporal.PlainMonthDay.fromdoes: 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, because a month-day without a year is read only in the ISO calendar. - Rejects a year, a time, a
Zand an offset. - A value that is not a string, a
Stringobject included, returnsfalse. Atrueresult narrows anunknownvalue tostring.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | any value; a string is checked as an ISO month-day |
Returns
Section titled “Returns”boolean indicating validity
Examples
Section titled “Examples”import { isValidMonthDay } from "@northguild/gmt/plain/validate";
isValidMonthDay("--12-25") // trueSource
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.