Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
ebx-timezone-mock
Advanced tools
A JavaScript library which mocks the Date object and lets you specify a local date/time/timezone in order to enable consistent testing of date/time-related code independently of your local system time settings.
A JavaScript library which mocks the Date
object and lets you specify a local date/time/timezone in order to enable consistent testing of date/time-related code independently of your local system time settings.
It works by monkey patching the Date
object and returning results which are adjusted to reflect the effects of both the specified current date/time/timezone (if any) and the current date/time/timezone. In particular, it avoids problems caused by certain JavaScript date/time methods e.g. getHours
returning results in the user's local system time, so you can write date/time-related unit tests which will work whenever and wherever they are run, without changing timezones causing results to change.
$ npm install ebx-timezone-mock
import TimezoneMock from 'TimezoneMock';
TimezoneMock.set('2018-04-25T12:34:56.000Z');
console.log(new Date()); // Wed Apr 25 2018 12:34:56 GMT+0000 (GMT Standard Time)
TimezoneMock.reset();
console.log(new Date()); // Current system date/time/timezone
The majority of the code for this project was taken from the timezone-mock project by Jimb Esser, with some additional code from the MockDate project by Bob Lauer. My contribution has been limited to gluing these two projects together, and introduction moment-timezone to solve the problem of working out the timezone offset for any given date, time and place.
1.1.4
Changes:
FAQs
A JavaScript library which mocks the Date object and lets you specify a local date/time/timezone in order to enable consistent testing of date/time-related code independently of your local system time settings.
The npm package ebx-timezone-mock receives a total of 0 weekly downloads. As such, ebx-timezone-mock popularity was classified as not popular.
We found that ebx-timezone-mock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.