Skip to content

day

const day: RegExp = /^(0[1-9]|[12][0-9]|3[01])$/;

RegExp matching an ISO 8601 day of the month: 01–31 (shape only; whether the day exists in its month is checked by Temporal.PlainDate.from in isValidDate).

import { day } from "@northguild/gmt";
day.test("01") // true
day.test("31") // true
day.test("32") // false (out of range)
day.test("00") // false (day zero)
day.test("9") // false (not zero-padded)

regex/date.ts