Skip to content

fhirInstant

  • The core functions, which every industry uses.
const fhirInstant: 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])T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\.[0-9]+)?(Z|(\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00))$/;

RegExp matching a FHIR R4 instant: the regex of the instant StructureDefinition (https://hl7.org/fhir/R4/instant.profile.json), verbatim and anchored.

import { fhirInstant } from "@northguild/gmt";
fhirInstant.test("2015-02-07T13:28:17.239+02:00") // true
fhirInstant.test("2024-06-15T10:30:00Z") // true
fhirInstant.test("2024-06-15") // false (an instant needs a time)
fhirInstant.test("2024-06-15T10:30:00") // false (a zone is required)
fhirInstant.test("2024-06-15T10:30:00z") // false (upper-case Z only)

regex/fhir.ts

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.