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 - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

2

dist/get-string-separator/get-string-separator.function.js

@@ -1,1 +0,1 @@

"use strict";function e(e){var r=/\D/.exec(e);return r?r[0]:""}Object.defineProperty(exports,"__esModule",{value:!0}),exports.getStringSeparator=e;
export function getStringSeparator(t){const e=/\D/.exec(t);return e?e[0]:""}

@@ -1,1 +0,1 @@

"use strict";function i(i){for(var e in i)exports.hasOwnProperty(e)||(exports[e]=i[e])}Object.defineProperty(exports,"__esModule",{value:!0}),i(require("./is-valid-date/is-valid-date.function")),i(require("./is-valid-iso-datestring/is-valid-iso-datestring.function")),i(require("./is-valid-time/is-valid-time.function")),i(require("./is-valid-year-month/is-valid-year-month.function"));
export*from"./is-valid-date/is-valid-date.function";export*from"./is-valid-iso-datestring/is-valid-iso-datestring.function";export*from"./is-valid-time/is-valid-time.function";export*from"./is-valid-year-month/is-valid-year-month.function";

@@ -1,1 +0,1 @@

"use strict";function e(e,t){return void 0===t&&(t="-"),new RegExp("^(?!0{4}"+t+"0{2}"+t+"0{2})((?=[0-9]{4}"+t+"(((0[^2])|1[0-2])|02(?="+t+"(([0-1][0-9])|2[0-8])))"+t+"[0-9]{2})|(?=((([13579][26])|([2468][048])|(0[48]))0{2})|([0-9]{2}((((0|[2468])[48])|[2468][048])|([13579][26])))"+t+"02"+t+"29))([0-9]{4})"+t+"(?!((0[469])|11)"+t+"31)((0[1,3-9]|1[0-2])|(02(?!"+t+"3)))"+t+"([0-2][0-9]|3[0-1])$").test(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isValidDate=e;
export function isValidDate($,e="-"){return new RegExp(`^(?!0{4}${e}0{2}${e}0{2})((?=[0-9]{4}${e}(((0[^2])|1[0-2])|02(?=${e}(([0-1][0-9])|2[0-8])))${e}[0-9]{2})|(?=((([13579][26])|([2468][048])|(0[48]))0{2})|([0-9]{2}((((0|[2468])[48])|[2468][048])|([13579][26])))${e}02${e}29))([0-9]{4})${e}(?!((0[469])|11)${e}31)((0[1,3-9]|1[0-2])|(02(?!${e}3)))${e}([0-2][0-9]|3[0-1])$`).test($)}

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("../get-string-separator/get-string-separator.function"),r=require("../is-valid-date/is-valid-date.function"),e=require("../is-valid-time/is-valid-time.function");function t(t){var s=t.split("T"),n=s[0],u=s[1],d=i.getStringSeparator(n);return r.isValidDate(n,d)&&e.isValidTime(u,a(u),!0)}function a(i){var r=i.match(/[^Z+\-\d]/);return Array.isArray(r)?r[0]:""}exports.isValidISODateString=t;
import{getStringSeparator as t}from"../get-string-separator/get-string-separator.function";import{isValidDate as i}from"../is-valid-date/is-valid-date.function";import{isValidTime as r}from"../is-valid-time/is-valid-time.function";export function isValidISODateString(o){const[a,s]=o.split("T"),e=t(a),m=i(a,e);return!!s&&(m&&r(s,n(s),!0))}function n(t){const i=t.match(/[^Z+\-\d]/);return Array.isArray(i)?i[0]:""}

@@ -1,1 +0,1 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../get-string-separator/get-string-separator.function"),t=require("../is-valid-timezone-offset/is-valid-timezone-offset.function");function r(r,i,s){void 0===i&&(i=":"),void 0===s&&(s=!1);var n=new RegExp("^([0-1]|2(?=([0-3])|4"+i+"00))[0-9]"+i+"[0-5][0-9]("+i+"([0-5]|6(?=0))[0-9])?(.[0-9]{1,9})?$");if(!s||!/[Z+\-]/.test(r))return n.test(r);if(/Z$/.test(r))return n.test(r.replace("Z",""));var o=r.includes("+"),a=r.split(/[+-]/),f=a[0],u=a[1];return n.test(f)&&t.isValidZoneOffset(u,o,e.getStringSeparator(u))}exports.isValidTime=r;
import{getStringSeparator as t}from"../get-string-separator/get-string-separator.function";import{isValidZoneOffset as e}from"../is-valid-timezone-offset/is-valid-timezone-offset.function";export function isValidTime(i,r=":",s=!1){const n=new RegExp(`^([0-1]|2(?=([0-3])|4${r}00))[0-9]${r}[0-5][0-9](${r}([0-5]|6(?=0))[0-9])?(.[0-9]{1,9})?$`);if(!s||!/[Z+\-]/.test(i))return n.test(i);if(/Z$/.test(i))return n.test(i.replace("Z",""));const o=i.includes("+"),[f,a]=i.split(/[+-]/);return n.test(f)&&e(a,o,t(a))}

@@ -1,1 +0,1 @@

"use strict";function e(e,t,s){return void 0===s&&(s=":"),new RegExp(t?"^(0(?!(2"+s+"4)|0"+s+"3)|1(?=([0-1]|2(?="+s+"[04])|[34](?="+s+"0))))([03469](?="+s+"[03])|[17](?="+s+"0)|2(?="+s+"[04])|5(?="+s+"[034])|8(?="+s+"[04]))"+s+"([03](?=0)|4(?=5))[05]$":"^(0(?=[^0])|1(?=[0-2]))([39](?="+s+"[03])|[0-24-8](?="+s+"00))"+s+"[03]0$").test(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isValidZoneOffset=e;
export function isValidZoneOffset($,e,t=":"){return new RegExp(e?`^(0(?!(2${t}4)|0${t}3)|1(?=([0-1]|2(?=${t}[04])|[34](?=${t}0))))([03469](?=${t}[03])|[17](?=${t}0)|2(?=${t}[04])|5(?=${t}[034])|8(?=${t}[04]))${t}([03](?=0)|4(?=5))[05]$`:`^(0(?=[^0])|1(?=[0-2]))([39](?=${t}[03])|[0-24-8](?=${t}00))${t}[03]0$`).test($)}

@@ -1,1 +0,1 @@

"use strict";function e(e,t){return void 0===t&&(t="-"),new RegExp("^[0-9]{4}"+t+"(0(?=[^0])|1(?=[0-2]))[0-9]$").test(e)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.isValidYearMonth=e;
export function isValidYearMonth(e,t="-"){return new RegExp(`^[0-9]{4}${t}(0(?=[^0])|1(?=[0-2]))[0-9]$`).test(e)}

@@ -31,3 +31,3 @@ {

"license": "MIT",
"version": "2.1.2",
"version": "2.1.3",
"keywords": [

@@ -43,3 +43,5 @@ "date",

"main": "./dist/index.js",
"files": ["dist/**"],
"files": [
"dist/**"
],
"description": "The goal of the package is to provide lightweight tools for validating strings denotings dates and time. It includes ISO 8601 datestring validation, simple YYYY-MM-DD date validation and time validation in hh:mm:ss.fff format. See details in readme.",

@@ -46,0 +48,0 @@ "repository": {

@@ -44,8 +44,2 @@ # iso-datestring-validator

or
```
const isoDatestringValidator = require('iso-datestring-validator');
```
alternatively you can import the function that you need separately:

@@ -52,0 +46,0 @@

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