UNPKG

@northguild/gmt

Version:

Date and time library for JavaScript and TypeScript, built on TC39 Temporal: time zones, DST, business days, ISO 8601 strings in and out. Never throws.

15 lines (14 loc) • 505 B
// src/internal/yearMonth.ts /** * The canonical `YYYY-MM` string of a year-month (`±YYYYYY-MM` outside 0000-9999): the form every * year-month function writes. Temporal's reference day (1) is never written. * * @param yearMonth an ISO-calendar `PlainYearMonth` * @returns the year-month string * * @example yearMonthString(Temporal.PlainYearMonth.from("2026-10")) // "2026-10" */ function yearMonthString(yearMonth) { return yearMonth.toString({ calendarName: "never" }); } export { yearMonthString };