# is-fhir-date

> Determines if a given string is a valid FHIR `date` _and_ also checks it for validity.

Latest version **1.0.1** (published 2025-12-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-fhir-date
pnpm add is-fhir-date
yarn add is-fhir-date
bun add is-fhir-date
```

## Health

**Score 50/100 (C)** — status: stable.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2025-12-10 |
| First published | 2021-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Henrik Joreteg |
| Maintainers | latentflip, henrikjoreteg |
| Keywords | date, fhir |

## Links

- npm: https://www.npmjs.com/package/is-fhir-date
- Repository: https://github.com/henrikjoreteg/is-fhir-date
- Issues: https://github.com/henrikjoreteg/is-fhir-date
- npm.io page: https://npm.io/package/is-fhir-date

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2025-12-10
- 0.0.1 — 2023-07-21
- 1.0.0 — 2021-04-22

## README

# is-fhir-date

![](https://img.shields.io/npm/dm/is-fhir-date.svg)![](https://img.shields.io/npm/v/is-fhir-date.svg)![](https://img.shields.io/npm/l/is-fhir-date.svg)

Tiny module that determines if a given given string is a valid FHIR `date` type as per: https://www.hl7.org/fhir/datatypes.html#date _and_ also checks it for validity.

The FHIR spec only specifies a regexp format, it does not check them for validity.

This module confirms **both** format and validity.

For example, the following will all pass the regexp but should _not_ be considered valid because they're not valid dates:

```
'2021-02-29' // this is not a leap year
'2021-02-30' // february doesn't have 30 days
'2021-04-31' // april doesn't have 31 days
```

## install

```
npm install is-fhir-date
```

# usage

```js
import isFhirDate from 'is-fhir-date'

isFhirDate('sept 29 82') // false
isFhirDate('1982') // true
isFhirDate('1982-12') // true
isFhirDate('1982-12-14') // true
isFhirDate('1998-02-30') // false
isFhirDate('2021-04-31') // false
```

# test

```
npm test
```

## Change log

- `1.0.1`: Internal typechecking improvements, no functional change.
- `1.0.0`: First public release.

## credits

If you like this follow [@HenrikJoreteg](http://twitter.com/henrikjoreteg) on twitter. This was built for and is in use in: [Xchart.com](https://xchart.com).

## license

[MIT](http://mit.joreteg.com/)

---
_Source: https://npm.io/package/is-fhir-date · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
