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

@shopify/dates

Package Overview
Dependencies
Maintainers
13
Versions
112
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/dates - npm Package Compare versions

Comparing version 0.2.13-beta.fixchrome80 to 0.2.13-fixmemoryleak-beta.1

4

CHANGELOG.md

@@ -9,6 +9,2 @@ # Changelog

## [Unreleased]
- Move Chrome 80 bug fix outside of gaurding if
## [0.2.12] - 2020-02-07

@@ -15,0 +11,0 @@

2

dist/src/utilities/formatDate.d.ts
interface FormatDateOptions extends Intl.DateTimeFormatOptions {
hourCycle?: string;
}
export declare function formatDate(date: Date, locales: string | string[], options?: FormatDateOptions): string;
export declare function formatDate(date: Date, locales: string | string[], options?: FormatDateOptions): any;
export {};
//# sourceMappingURL=formatDate.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var function_enhancers_1 = require("@shopify/function-enhancers");
var memoizedGetDateTimeFormat = function_enhancers_1.memoize(getDateTimeFormat, dateTimeFormatCacheKey);
var intl = new Map();
var memoizedGetDateTimeFormat = function (locale, options) {
var key = dateTimeFormatCacheKey(locale, options);
if (intl.has(key)) {
return intl.get(key);
}
var i = new Intl.DateTimeFormat(locale, options);
intl.set(key, i);
return i;
};
function formatDate(date, locales, options) {
if (options === void 0) { options = {}; }
if (options.hour12 != null && options.hourCycle != null) {
options.hour12 = undefined;
options.hourCycle = 'h23';
}
// Etc/GMT+12 is not supported in most browsers and there is no equivalent fallback

@@ -13,14 +25,7 @@ if (options.timeZone != null && options.timeZone === 'Etc/GMT+12') {

}
if (options.hour12 != null) {
options.hour12 = undefined;
options.hourCycle = 'h23';
}
return memoizedGetDateTimeFormat(locales, options).format(date);
}
exports.formatDate = formatDate;
function getDateTimeFormat(locales, options) {
return Intl.DateTimeFormat(locales, options);
}
function dateTimeFormatCacheKey(locales, options) {
return locales + "-" + JSON.stringify(options);
}
{
"name": "@shopify/dates",
"version": "0.2.13-beta.fixchrome80",
"version": "0.2.13-fixmemoryleak-beta.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Lightweight date operations library.",

Sorry, the diff of this file is not supported yet

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