@brightspace-ui/intl
Advanced tools
Comparing version 3.13.0 to 3.13.1
@@ -1201,17 +1201,2 @@ import { getDocumentLocaleSettings, getLanguage, merge } from './common.js'; | ||
if (unit === 'day' || unit === 'hour' && Math.round(Math.abs(value)) >= 6) { | ||
const fullDay = 24 * 60 * 60 * 1000; | ||
const today = new Date(now.toDateString()).getTime(); | ||
const yesterday = thenTS < today && thenTS > (today - fullDay); | ||
const tomorrow = thenTS >= today + fullDay && thenTS < (today + fullDay * 2); | ||
if (yesterday || tomorrow) { | ||
numeric = 'auto'; | ||
unit = 'day'; | ||
value = Math.sign(value); | ||
} | ||
} | ||
if (unit === 'week' || unit === 'day' && Math.round(Math.abs(value)) >= 4) { | ||
@@ -1226,3 +1211,3 @@ | ||
const lastWeek = thenTS < thisWeek && thenTS > (thisWeek - fullWeek); | ||
const lastWeek = thenTS < thisWeek && thenTS >= (thisWeek - fullWeek); | ||
const nextWeek = thenTS >= thisWeek + fullWeek && thenTS < (thisWeek + fullWeek * 2); | ||
@@ -1236,3 +1221,17 @@ | ||
} | ||
else if (unit === 'day' || unit === 'hour' && Math.round(Math.abs(value)) >= 6) { | ||
const fullDay = 24 * 60 * 60 * 1000; | ||
const today = new Date(now.toDateString()).getTime(); | ||
const yesterday = thenTS < today && thenTS >= (today - fullDay); | ||
const tomorrow = thenTS >= today + fullDay && thenTS < (today + fullDay * 2); | ||
if (yesterday || tomorrow) { | ||
numeric = 'auto'; | ||
unit = 'day'; | ||
value = Math.sign(value); | ||
} | ||
} | ||
const rtf = new Intl.RelativeTimeFormat(getLanguage(), { | ||
@@ -1239,0 +1238,0 @@ localeMatcher: 'best fit', |
{ | ||
"name": "@brightspace-ui/intl", | ||
"version": "3.13.0", | ||
"version": "3.13.1", | ||
"description": "Internationalization APIs for number, date, time and file size formatting and parsing in D2L Brightspace.", | ||
@@ -5,0 +5,0 @@ "main": "lib/number.js", |
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
76055