Skip to content

parseMonthDay

parseMonthDay(value: string): string

Return the canonical --MM-DD form of an ISO month-day string.

  • Reads --MM-DD and MM-DD; writes --MM-DD. The reference year 1972 is never written.
  • The extended form only: --1225 and 1225 are refused.
  • Annotations are read as isValidMonthDay reads them: elective and time zone annotations are ignored, an unknown critical one refuses, and u-ca must be iso8601 in any case.
  • --02-29 is valid; --02-30 and --04-31 are not.
  • Returns "" for invalid input.
ParameterTypeDescription
valuestringISO month-day string

the --MM-DD string, or "" on invalid input

import { parseMonthDay } from "@northguild/gmt/plain/parse";
parseMonthDay("--12-25") // "--12-25"
output 

plain/parse/parseMonthDay.ts

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.