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.2.2 to 1.3.0

12

index.js

@@ -179,3 +179,3 @@ 'use strict';

MockDate.prototype.toString = MockDate.prototype.toLocaleString = function () {
MockDate.prototype.toString = function () {
if (this instanceof _Date) {

@@ -219,2 +219,12 @@ // someone, like util.inspect, calling Date.prototype.toString.call(foo)

MockDate.prototype.toLocaleString = function (locales, options) {
options = options || {};
var time = this.d.getTime();
if (Number.isNaN(time)) {
return new _Date('').toDateString();
}
options.timeZone = timezone;
return new _Date(time).toLocaleString(locales, options);
};
MockDate.prototype.toLocaleDateString = function (locales, options) {

@@ -221,0 +231,0 @@ options = options || {};

2

package.json
{
"name": "timezone-mock",
"version": "1.2.2",
"version": "1.3.0",
"description": "A JavaScript library to mock the local timezone.",

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

@@ -79,4 +79,10 @@ timezone-mock

The behavior of `toLocaleString()` has changed in v1.3.0 to more closely match Node's
behavior, but only works on Node v14+. Use v1.2.2 for the old behavior. See note below.
Most Date member functions are supported except for some conversions to
locale-specific date strings.
locale-specific date strings. These are mocked in a way that may only work
reliably on Node v14+. Note that using locale-specific formatting is often
device- and browser-dependant, so any use of these in tests may indicate a
potential bug.

@@ -83,0 +89,0 @@ With non-DST timezones, it should behave identically to the native Javascript

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