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

t-i18n

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

t-i18n - npm Package Compare versions

Comparing version 0.6.2 to 0.6.3

24

dist/es6/t-i18n.js

@@ -24,2 +24,26 @@ import createCachedFormatter, { numberFormats, dateTimeFormats } from "./format";

}
const getDateTimeFormat = () => {
const delegate = Intl.DateTimeFormat;
function DateTimeFormat() {
const args = Array.prototype.slice.apply(arguments);
args[0] = args[0] || "en-US";
args[1] = args[1] || {};
args[1].timeZone = args[1].timeZone || "America/Toronto";
return delegate.apply(this, args);
}
DateTimeFormat.prototype = delegate.prototype;
return DateTimeFormat;
};
try {
Intl.DateTimeFormat();
(new Date()).toLocaleString();
(new Date()).toLocaleDateString();
(new Date()).toLocaleTimeString();
}
catch (err) {
Date.prototype.toLocaleString = Date.prototype.toString;
Date.prototype.toLocaleDateString = Date.prototype.toDateString;
Date.prototype.toLocaleTimeString = Date.prototype.toTimeString;
Intl.DateTimeFormat = getDateTimeFormat();
}
const dateFormatter = createCachedFormatter(Intl.DateTimeFormat);

@@ -26,0 +50,0 @@ const numberFormatter = createCachedFormatter(Intl.NumberFormat);

@@ -26,2 +26,26 @@ "use strict";

}
var getDateTimeFormat = function () {
var delegate = Intl.DateTimeFormat;
function DateTimeFormat() {
var args = Array.prototype.slice.apply(arguments);
args[0] = args[0] || "en-US";
args[1] = args[1] || {};
args[1].timeZone = args[1].timeZone || "America/Toronto";
return delegate.apply(this, args);
}
DateTimeFormat.prototype = delegate.prototype;
return DateTimeFormat;
};
try {
Intl.DateTimeFormat();
(new Date()).toLocaleString();
(new Date()).toLocaleDateString();
(new Date()).toLocaleTimeString();
}
catch (err) {
Date.prototype.toLocaleString = Date.prototype.toString;
Date.prototype.toLocaleDateString = Date.prototype.toDateString;
Date.prototype.toLocaleTimeString = Date.prototype.toTimeString;
Intl.DateTimeFormat = getDateTimeFormat();
}
var dateFormatter = format_1.default(Intl.DateTimeFormat);

@@ -28,0 +52,0 @@ var numberFormatter = format_1.default(Intl.NumberFormat);

2

package.json
{
"name": "t-i18n",
"version": "0.6.2",
"version": "0.6.3",
"description": "Simple, standards-based localization",

@@ -5,0 +5,0 @@ "author": "Mitch Cohen <mitch.cohen@me.com>",

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