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 1.0.11 to 1.0.12

9

index.js

@@ -35,6 +35,4 @@ var assert = require('assert');

}
} else if (typeof param === 'number') {
} else if (typeof param === 'number' || param === null || param === undefined) {
this.d = new _Date(param);
} else if (typeof param === 'undefined') {
this.d = new _Date();
} else {

@@ -79,2 +77,3 @@ assert.ok(false, 'Unhandled type passed to MockDate constructor: ' + typeof param);

MockDate.prototype[fn] = function () {
if (Number.isNaN(this.d.getTime())) return NaN;
var d = new _Date(this.d.getTime() - this.calcTZO() * HOUR);

@@ -157,2 +156,3 @@ return d['getUTC' + fn.slice(3)]();

MockDate.prototype.getTimezoneOffset = function () {
if (Number.isNaN(this.d.getTime())) return NaN;
return this.calcTZO() * 60;

@@ -166,2 +166,3 @@ };

}
if (Number.isNaN(this.d.getTime())) return new _Date('').toString();
return 'Mockday ' + this.d.toISOString() + ' GMT-0' + this.calcTZO() + '00 (MockDate)';

@@ -175,2 +176,3 @@ };

MockDate.prototype.toDateString = function () {
if (Number.isNaN(this.d.getTime())) return new _Date('').toDateString();
return `${ weekDays[this.getDay()] } ${ months[this.getMonth()] } ${ this.getDate().toString().padStart(2, '0') } ${ this.getFullYear() }`;

@@ -180,3 +182,2 @@ };

// TODO:
// 'toDateString',
// 'toLocaleDateString',

@@ -183,0 +184,0 @@ // 'toLocaleTimeString',

{
"name": "timezone-mock",
"version": "1.0.11",
"version": "1.0.12",
"description": "A JavaScript library to mock the local timezone.",

@@ -5,0 +5,0 @@ "main": "index.js",

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