Comparing version 2.1.0 to 2.1.1
@@ -5,3 +5,3 @@ "use strict"; | ||
const errors_1 = require("./errors"); | ||
const isoDateRegex = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/; | ||
const isoDateRegex = /^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d(\.\d+)?([+-][0-2]\d:[0-5]\d|Z)$/; | ||
function parseDate({ iso = false } = {}) { | ||
@@ -8,0 +8,0 @@ return (value) => { |
@@ -15,2 +15,7 @@ "use strict"; | ||
}); | ||
it('should parse an ISO date string without milliseconds', () => { | ||
const date = '2018-10-22T09:40:40Z'; | ||
const parsedDate = parse_date_1.parseDate({ iso: true })(date); | ||
chai_1.expect(parsedDate.getTime()).to.equal(new Date(date).getTime()); | ||
}); | ||
it('return parsed date', () => { | ||
@@ -17,0 +22,0 @@ const date = new Date(); |
{ | ||
"name": "fefe", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Validate, sanitize and transform values with proper types.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -17,2 +17,8 @@ import { expect } from 'chai' | ||
it('should parse an ISO date string without milliseconds', () => { | ||
const date = '2018-10-22T09:40:40Z' | ||
const parsedDate = parseDate({ iso: true })(date) | ||
expect(parsedDate.getTime()).to.equal(new Date(date).getTime()) | ||
}) | ||
it('return parsed date', () => { | ||
@@ -19,0 +25,0 @@ const date = new Date() |
import { FefeError } from './errors' | ||
const isoDateRegex = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/ | ||
const isoDateRegex = /^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d(\.\d+)?([+-][0-2]\d:[0-5]\d|Z)$/ | ||
@@ -5,0 +5,0 @@ export function parseDate ({ iso = false }: { iso?: boolean } = {}) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104568
1584