
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
timezonedate
Advanced tools
A JavaScript Date alternative that is specific to a given timezone other than the current machine's timezone.
A JavaScript Date alternative that is specific to a given timezone other than the current machine's timezone.
npm install timezonedate
TimeZoneDate has been tested in Node, IE9+, Chrome, Firefox, and Opera.
// CommonJS
var TimeZoneDate = require('timezonedate');
// AMD
require(['timezonedate'], function(TimeZoneDate) { ... });
// Script Tag
var TimeZoneDate = window.TimeZoneDate;
function TimeZoneDate(offset[, initialDate])
type: Number
There are two ways to specify a timezone offset.
The easiest is by passing in the hours relative to UTC. So if you want to specify the timezone one hour behind UTC, you would pass in -1. For one hour ahead of UTC, you would pass in 1.
The other way to specify the timezone is to pass in what the result of new Date().getTimezoneOffset() would be if it were run in the target timezone. For example, if your system clock is set to UTC-1, new Date().getTimezoneOffset() will be 60. If you are in UTC+1, the result will be -60. Check out the MDN getTimezoneOffset documentation for more info.
type: Date or String
If a Date object is passed in, the TimeZoneDate will be set to the same moment, rather than the same time. For example:
// Assume the current machine is set to UTC-1
var dateInUTCMinus1 = new Date('1/1/2014 12:00:00');
var dateInUTCPlus1 = new TimeZoneDate(1, dateInUTCMinus1);
dateInUTCMinus1.valueOf() === dateInUTCPlus1.valueOf();
// true
dateInUTCMinus1.toString();
// Wed Jan 01 2014 12:00:00 GMT-0100
dateInUTCPlus1.toString();
// Wed Jan 01 2014 14:00:00 GMT+0100
If a string is passed in, the TimeZoneDate will be set to that date/time. For example:
// Assume the current machine is set to UTC-1
var dateInUTCMinus1 = new Date('1/1/2014 12:00:00');
var dateInUTCPlus1 = new TimeZoneDate(1, '1/1/2014 12:00:00');
dateInUTCMinus1.valueOf() === dateInUTCPlus1.valueOf();
// false
dateInUTCMinus1.toString();
// Wed Jan 01 2013 12:00:00 GMT-0100
dateInUTCPlus1.toString();
// Wed Jan 01 2013 12:00:00 GMT+0100
If the initialDate parameter is omitted, it is the equivalent of passing in new Date().
The rest of the API is exactly the same as the native Date object.
FAQs
A JavaScript Date alternative that is specific to a given timezone other than the current machine's timezone.
We found that timezonedate 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.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.