# fhirDateTime

Industry: Core

```ts
const fhirDateTime: 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 `dateTime`: the `regex` of the `dateTime` StructureDefinition (https://hl7.org/fhir/R4/datetime.profile.json), verbatim and anchored.

## Examples

```ts
import { fhirDateTime } from "@northguild/gmt";
```

```ts
fhirDateTime.test("2024-06") // true
fhirDateTime.test("2015-02-07T13:28:17.239+02:00") // true
fhirDateTime.test("2024-06-15T10:30:00") // false (a time needs a zone)
fhirDateTime.test("2024-06-15T10:30Z") // false (seconds are required)
fhirDateTime.test("2024-06-15T10:30:00+14:30") // false (offset past 14:00)
```

## Source

[regex/fhir.ts](https://github.com/northguild/gmt/blob/main/packages/gmt/src/regex/fhir.ts)
