formatMonthDay
Signature
Section titled “Signature”formatMonthDay(value: string, locale?: string | string[], options?: DateTimeFormatOptions): stringReturn a localized string for a month-day (--MM-DD or MM-DD) using Intl options.
- Formats as Temporal’s ECMA-402 PlainMonthDay format does: only
monthanddayare kept, at noon UTC on the ISO date in the 1972 reference year (so--02-29formats). The year is never printed. - Gregorian rule (GMT). Always formats through the Gregorian calendar, which names the same month and day as the ISO one. ICU formats
calendar: "iso8601"without the locale’s month-day pattern (Node prints" 25", browsersDezember 25for de-DE), andPlainMonthDay#toLocaleStringthrows for a calendar mismatch. A-u-ca-subtag inlocaleis overridden. With acalendaroption, the calendar Intl resolves must begregoryoriso8601, otherwise"". Intl ignores an unsupported value and uses the locale’s default, so{ calendar: "foo" }gives"12/25"in en-US and""in th-TH (Buddhist). dateStyle. The month and day widths are the locale’s owndateStyledate pattern’s, as ECMA-402 (AdjustDateTimeStyleFormat) and nativePlainMonthDay#toLocaleStringtake them: de-DEmediumis25.12., en-USmediumDec 25and zh-CNlong12/25. Polyfill 0.5.1 maps each style to fixed widths instead, so itstoLocaleStringprints25. Dez.for de-DEmedium.- A
year,weekday,era, time field ortimeZoneNameis dropped; only those fields with nomonthordaygive"", excepteraandtimeZoneName, which fall back to the defaults. - Returns
""for invalid input, atimeStyle, invalid options,nulloptions or an ill-formed locale.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | string | ISO month-day string |
locale | string | string[] | optional BCP 47 locale identifier (default: runtime default), or a preference list of tags (ECMA-402) |
Options
Section titled “Options”options
optional Intl.DateTimeFormatOptions
Type: DateTimeFormatOptions.
| Option | Type | Default | Description |
|---|---|---|---|
…Intl.DateTimeFormatOptions | — | — | Every field of DateTimeFormatOptions, as ECMA-402 defines it. |
Returns
Section titled “Returns”localized month-day string or "" on invalid input
Related types
Section titled “Related types”Examples
Section titled “Examples”import { formatMonthDay } from "@northguild/gmt/plain/format";
formatMonthDay("--12-25", "en-US") // "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.