🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

is-fhir-date

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-fhir-date

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

0.0.1
latest
Source
npm
Version published
Weekly downloads
284
54.35%
Maintainers
1
Weekly downloads
 
Created
Source

is-fhir-date

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

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.0: First public release.

credits

If you like this follow @HenrikJoreteg on twitter. This was built for and is in use in: AnesthesiaCharting.com.

license

MIT

Keywords

date

FAQs

Package last updated on 21 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts