Skip to content

plainMonthDay

const plainMonthDay: RegExp = /^(?:--)?(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|02-(?:0[1-9]|[12]\d))$/;

RegExp matching an ISO 8601 month-day (extended): --MM-DD or MM-DD.

import { plainMonthDay } from "@northguild/gmt";
plainMonthDay.test("--12-25") // true
plainMonthDay.test("12-25") // true (the -- is optional)
plainMonthDay.test("--02-29") // true (exists in the 1972 reference year)
plainMonthDay.test("--02-30") // false (no such day in any year)
plainMonthDay.test("--1225") // false (basic format)

regex/month-day.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.