fhirDate
const fhirDate: RegExp = /^([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1]))?)?$/;RegExp matching a FHIR R4 date: the regex of the date StructureDefinition (https://hl7.org/fhir/R4/date.profile.json), verbatim and anchored.
Examples
Section titled “Examples”import { fhirDate } from "@northguild/gmt";fhirDate.test("2024-06-15") // truefhirDate.test("2024") // true (year precision)fhirDate.test("2024-06-15T10:30:00Z") // false (a date carries no time)fhirDate.test("0000-01-01") // false (year 0000 is not in the pattern)fhirDate.test("2023-02-29") // true (shape only; the day does not exist)Source
Section titled “Source”Accessibility
© 2026 NorthGuild · Licences
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.