Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

iso-datestring-validator

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iso-datestring-validator

A simple function for ISO9601 date string validation. It validates any YYYY-MM-DD date from 0001-01-01 up to 9999-12-31 with a regular expression, leap years friendly.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
44K
decreased by-0.34%
Maintainers
1
Weekly downloads
 
Created
Source

iso-8601-date-string-validator

(the package will be republished on npm soon)

A simple function for ISO9601 date string validation. It validates any YYYY-MM-DD date from 0001-01-01 up to 9999-12-31 with a regular expression, leap years friendly.

The function itself takes two arguments, first being the date string, the second being an optional one symbol separator, by default it is

function(date, separator = "-")

The validation is done with a regular expression, which has been covered by jest tests. It correctly validates all dates between 0001-01-01 and 9999-12-31, correctly recognizing leap years.

Install

npm i --save iso-datestring-validator

or

yarn add iso-datestring-validator

Import and use

const isIsoDatestring = require("iso-8601-date-string-validator");

isIsoDatestring('2019-01-01');
// true

isIsoDatestring('1900-02-29');
// false (1900 was not a leap year, so the date is invalid)

That's all there's to tell about this package.

Keywords

FAQs

Package last updated on 07 Jul 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc