timezone-mock
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -14,2 +14,3 @@ var assert = require('assert'); | ||
var date_with_offset=/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d\:\d\d(\.\d\d\d)? (Z|(\-|\+|)\d\d\:\d\d)$/; | ||
var date_rfc_2822_regex=/^\d\d-\w\w\w-\d\d\d\d \d\d\:\d\d\:\d\d (\+|-)\d\d\d\d$/; | ||
var local_date_regex=/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d\:\d\d(\.\d\d\d)?$/; | ||
@@ -22,3 +23,3 @@ | ||
} else if (typeof param === 'string') { | ||
if (param.match(date_iso_8601_regex) || param.match(date_with_offset)) { | ||
if (param.match(date_iso_8601_regex) || param.match(date_with_offset) || param.match(date_rfc_2822_regex)) { | ||
this.d = new _Date(param); | ||
@@ -25,0 +26,0 @@ } else if (param.match(local_date_regex)) { |
{ | ||
"name": "timezone-mock", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A JavaScript library to mock the local timezone.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -35,1 +35,14 @@ var assert = require('assert'); | ||
assert.equal(1414915200000, new Date(2014, 10, 2, 1, 0, 0, 0).getTime()); | ||
////////////////////////////////////////////////////////////////////////// | ||
// Test UTC/non-local timezone constructors | ||
assert.equal(1495821155869, new Date('2017-05-26T17:52:35.869').getTime()); | ||
assert.equal(1495821155869, new Date('2017-05-26T17:52:35.869Z').getTime()); | ||
assert.equal(1495821155869, new Date('2017-05-26 17:52:35.869 Z').getTime()); | ||
assert.equal(1495821155869, new Date('2017-05-26 17:52:35.869 -00:00').getTime()); | ||
assert.equal(1495821155869, new Date('2017-05-26 17:52:35.869 +00:00').getTime()); | ||
assert.equal(1495821155869, new Date('2017-05-26 18:52:35.869 +01:00').getTime()); | ||
assert.equal(1495821155869, new Date('2017-05-26 10:52:35.869 -07:00').getTime()); | ||
assert.equal(1495821155000, new Date('2017-05-26T17:52:35').getTime()); | ||
assert.equal(1495821155000, new Date('2017-05-26 17:52:35 +00:00').getTime()); | ||
assert.equal(1495821155000, new Date('2017-05-26 10:52:35 -07:00').getTime()); |
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
24114
623