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

date-fns-tz

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

date-fns-tz - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

18

_lib/tzParseTimezone/index.js

@@ -18,4 +18,3 @@ "use strict";

timezoneHH: /^([+-])(\d{2})$/,
timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/,
timezoneIANA: /(UTC|(?:[a-zA-Z]+\/[a-zA-Z_-]+(?:\/[a-zA-Z_]+)?))$/
timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/
}; // Parse various time zone offset formats to an offset in milliseconds

@@ -64,5 +63,3 @@

token = patterns.timezoneIANA.exec(timezoneString);
if (token) {
if (isValidTimezoneIANAString(timezoneString)) {
date = new Date(date || Date.now());

@@ -123,2 +120,13 @@ var utcDate = isUtcDate ? date : toUtcDate(date);

function isValidTimezoneIANAString(timeZoneString) {
try {
Intl.DateTimeFormat(undefined, {
timeZone: timeZoneString
});
return true;
} catch {
return false;
}
}
module.exports = exports.default;

@@ -10,4 +10,3 @@ import tzTokenizeDate from '../tzTokenizeDate/index.js'

timezoneHH: /^([+-])(\d{2})$/,
timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/,
timezoneIANA: /(UTC|(?:[a-zA-Z]+\/[a-zA-Z_-]+(?:\/[a-zA-Z_]+)?))$/,
timezoneHHMM: /^([+-])(\d{2}):?(\d{2})$/
}

@@ -56,4 +55,3 @@

// IANA time zone
token = patterns.timezoneIANA.exec(timezoneString)
if (token) {
if (isValidTimezoneIANAString(timezoneString)) {
date = new Date(date || Date.now())

@@ -131,1 +129,11 @@ var utcDate = isUtcDate ? date : toUtcDate(date)

}
function isValidTimezoneIANAString(timeZoneString) {
try {
Intl.DateTimeFormat(undefined, {timeZone: timeZoneString});
return true;
}
catch {
return false;
}
}
{
"name": "date-fns-tz",
"version": "1.1.4",
"version": "1.1.5",
"sideEffects": false,

@@ -5,0 +5,0 @@ "description": "Time zone support for date-fns v2 with the browser Intl API",

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