Skip to content

isValidMonthDay

isValidMonthDay(value: string): boolean
isValidMonthDay(value: void | {} | null | undefined): boolean
isValidMonthDay(value: unknown): value is string

Return 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 (--1225 and 1225 are refused, as isValidDate refuses 20241225), with a day that exists in at least one year. --02-29 is valid; --02-30 and --04-31 are not.
  • Reads RFC 9557 annotations as Temporal.PlainMonthDay.from does: 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 Z and an offset.
  • A value that is not a string, a String object included, returns false. A true result narrows an unknown value to string.
ParameterTypeDescription
valuestringany value; a string is checked as an ISO month-day

boolean indicating validity

import { isValidMonthDay } from "@northguild/gmt/plain/validate";
isValidMonthDay("--12-25") // true
output 

plain/validate/isValidMonthDay.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.