monthDayToDate
Signature
Section titled “Signature”monthDayToDate(monthDay: string, year: number): stringThe ISO date of a month-day in a given year.
--02-29in a year that is not a leap year gives 28 February. This is theconstrainstep of Temporal’sPlainMonthDay.prototype.toPlainDate(CalendarDateFromFields withconstrain). The result is never 1 March and never"".yearmust be an integer. A fractional, string orbigintyear gives""; Temporal would truncate or coerce it, and gmt does not.- Only the ISO calendar is read; a month-day with another calendar annotation gives
"".
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
monthDay | string | a month-day, --MM-DD or MM-DD |
year | number | an integer, as Temporal’s ISO calendar counts it: 0 is 1 BCE and -1 is 2 BCE |
Returns
Section titled “Returns”the ISO date, or "" when monthDay is not a valid month-day, year is not an integer, or the date falls outside the PlainDate range
Examples
Section titled “Examples”import { monthDayToDate } from "@northguild/gmt/plain/convert";
monthDayToDate("--12-25", 2024) // "2024-12-25"Source
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.