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

timezone-mock

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timezone-mock - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

3

index.js

@@ -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());
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