@shopify/dates
Advanced tools
Comparing version 0.0.0-snapshot-20221110184102 to 0.0.0-snapshot-20221111164351
@@ -17,7 +17,5 @@ 'use strict'; | ||
} | ||
const browserFeatureDetectionDate = Intl.DateTimeFormat('en', { | ||
hour: 'numeric', | ||
// FormatJS's DateTimeFormat only supports the Gregorian calendar | ||
// link: https://formatjs.io/docs/polyfills/intl-datetimeformat/ | ||
calendar: 'gregory' | ||
const browserFeatureDetectionDate = options => Intl.DateTimeFormat('en', { ...options, | ||
hour: 'numeric' | ||
}); // hourCycle to Intl.DateTimeFormatOptions was added in TS 4.2, so we could | ||
@@ -27,5 +25,8 @@ // remove this, but that would require consumers to update to at least TS 4.2 | ||
const resolvedOptions = typeof browserFeatureDetectionDate.resolvedOptions === 'undefined' ? undefined : browserFeatureDetectionDate.resolvedOptions(); | ||
const resolvedOptions = options => typeof browserFeatureDetectionDate(options).resolvedOptions === 'undefined' ? undefined : browserFeatureDetectionDate(options).resolvedOptions(); | ||
function formatDate(date, locales, options = {}) { | ||
const hourCycleRequired = resolvedOptions != null && options.hour12 === false && resolvedOptions.hourCycle != null; | ||
const ro = resolvedOptions(options); | ||
const hourCycleRequired = ro != null && options.hour12 === false && ro.hourCycle != null; | ||
@@ -32,0 +33,0 @@ if (hourCycleRequired) { |
{ | ||
"name": "@shopify/dates", | ||
"version": "0.0.0-snapshot-20221110184102", | ||
"version": "0.0.0-snapshot-20221111164351", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Lightweight date operations library", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113082
1726