# FHIR Date Checker

Industry: Healthcare

**Key point — FHIR R4 date, dateTime and instant**

`2024-06` is a month. It is not midnight on the first.

Type a FHIR R4 value. FHIR is published by HL7 International, and it has three primitive types that carry a date: `date`, `dateTime` and `instant`. The tool calls [`parseFHIR`](/gmt/reference/healthcare/parse/parseFHIR/) and [`isValidFHIR`](/gmt/reference/healthcare/validate/isValidFHIR/) and shows which of the three types the value fits, and what it names: a year, a month, a day or an instant. The last section shows what [`formatFHIR`](/gmt/reference/healthcare/format/formatFHIR/) writes back.

**How a value is read.** `parseFHIR` keeps the precision that was sent. A year, a month or a day is a partial value with no instant, and the tool never pads it. A time to the second or finer with an offset is an instant. A `dateTime` with a time must also carry an offset or `Z`. Without one it is not a FHIR value, and the tool reads it neither as a local time nor as UTC.

**Why a pattern match is shape only.** HL7 International publishes one regular expression for each type, and the specification calls them "informative, not normative". A value can match its pattern and still not be a date, such as `2024-02-30`. The tool shows the pattern result and the library result side by side, and the "Why" line says what the pattern cannot catch.

**What the writer refuses.** `formatFHIR` writes a type only when the moment fits it, and the cell says "no result" when it does not. FHIR has no minute precision, so a time to the minute is not written. It has no leap second, so `:60` is refused. It never fills in what was not sent: a `date` has no time to give an `instant`, and the writer will not make one up. An offset of `-00:00` is kept as sent.

**The functions.** [`parseFHIR`](/gmt/reference/healthcare/parse/parseFHIR/) reads, [`formatFHIR`](/gmt/reference/healthcare/format/formatFHIR/) writes and [`isValidFHIR`](/gmt/reference/healthcare/validate/isValidFHIR/) tells a bad value from a good one. The rules are in [Healthcare: Clinical Timestamps](/gmt/guides/industries/healthcare-clinical-timestamps/#fhir-r4-date-datetime-and-instant). For an HL7 v2 value, use the [HL7 Timestamp Reader](/gmt/tools/hl7-timestamp-reader/).

**Worth trying:** [a date that is not on the calendar](/gmt/tools/fhir-date-checker/?w=fhir&wa=%7B%22preset%22%3A%22feb-30%22%7D), which matches its pattern and is still refused. Then [a time to the minute](/gmt/tools/fhir-date-checker/?w=fhir&wa=%7B%22preset%22%3A%22minute%22%7D): ISO 8601 allows it, and FHIR does not.
