@brightspace-ui/intl 3.13.0 → 3.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/lib/dateTime.js +15 -16
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -276,7 +276,7 @@ Contributions are welcome, please submit a pull request!
|
|
|
276
276
|
|
|
277
277
|
> TL;DR: Commits prefixed with `fix:` and `feat:` will trigger patch and minor releases when merged to `main`. Read on for more details...
|
|
278
278
|
|
|
279
|
-
The [
|
|
279
|
+
The [semantic-release GitHub Action](https://github.com/BrightspaceUI/actions/tree/main/semantic-release) is called from the `release.yml` GitHub Action workflow to handle version changes and releasing.
|
|
280
280
|
|
|
281
281
|
### Version Changes
|
|
282
282
|
|
package/lib/dateTime.js
CHANGED
|
@@ -1198,21 +1198,6 @@ export function formatRelativeDateTime(then) {
|
|
|
1198
1198
|
let numeric = 'always';
|
|
1199
1199
|
const thenTS = then.getTime();
|
|
1200
1200
|
|
|
1201
|
-
if (unit === 'day' || unit === 'hour' && Math.round(Math.abs(value)) >= 6) {
|
|
1202
|
-
|
|
1203
|
-
const fullDay = 24 * 60 * 60 * 1000;
|
|
1204
|
-
const today = new Date(now.toDateString()).getTime();
|
|
1205
|
-
|
|
1206
|
-
const yesterday = thenTS < today && thenTS > (today - fullDay);
|
|
1207
|
-
const tomorrow = thenTS >= today + fullDay && thenTS < (today + fullDay * 2);
|
|
1208
|
-
|
|
1209
|
-
if (yesterday || tomorrow) {
|
|
1210
|
-
numeric = 'auto';
|
|
1211
|
-
unit = 'day';
|
|
1212
|
-
value = Math.sign(value);
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
1201
|
if (unit === 'week' || unit === 'day' && Math.round(Math.abs(value)) >= 4) {
|
|
1217
1202
|
|
|
1218
1203
|
const fullWeek = 7 * 24 * 60 * 60 * 1000;
|
|
@@ -1222,7 +1207,7 @@ export function formatRelativeDateTime(then) {
|
|
|
1222
1207
|
return d.getTime();
|
|
1223
1208
|
})(new Date(now));
|
|
1224
1209
|
|
|
1225
|
-
const lastWeek = thenTS < thisWeek && thenTS
|
|
1210
|
+
const lastWeek = thenTS < thisWeek && thenTS >= (thisWeek - fullWeek);
|
|
1226
1211
|
const nextWeek = thenTS >= thisWeek + fullWeek && thenTS < (thisWeek + fullWeek * 2);
|
|
1227
1212
|
|
|
1228
1213
|
if (lastWeek || nextWeek) {
|
|
@@ -1231,6 +1216,20 @@ export function formatRelativeDateTime(then) {
|
|
|
1231
1216
|
value = Math.sign(value);
|
|
1232
1217
|
}
|
|
1233
1218
|
}
|
|
1219
|
+
else if (unit === 'day' || unit === 'hour' && Math.round(Math.abs(value)) >= 6) {
|
|
1220
|
+
|
|
1221
|
+
const fullDay = 24 * 60 * 60 * 1000;
|
|
1222
|
+
const today = new Date(now.toDateString()).getTime();
|
|
1223
|
+
|
|
1224
|
+
const yesterday = thenTS < today && thenTS >= (today - fullDay);
|
|
1225
|
+
const tomorrow = thenTS >= today + fullDay && thenTS < (today + fullDay * 2);
|
|
1226
|
+
|
|
1227
|
+
if (yesterday || tomorrow) {
|
|
1228
|
+
numeric = 'auto';
|
|
1229
|
+
unit = 'day';
|
|
1230
|
+
value = Math.sign(value);
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1234
1233
|
|
|
1235
1234
|
const rtf = new Intl.RelativeTimeFormat(getLanguage(), {
|
|
1236
1235
|
localeMatcher: 'best fit',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brightspace-ui/intl",
|
|
3
|
-
"version": "3.13.
|
|
3
|
+
"version": "3.13.2",
|
|
4
4
|
"description": "Internationalization APIs for number, date, time and file size formatting and parsing in D2L Brightspace.",
|
|
5
5
|
"main": "lib/number.js",
|
|
6
6
|
"scripts": {
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@babel/core": "^7",
|
|
40
40
|
"@babel/eslint-parser": "^7",
|
|
41
|
-
"@web/dev-server": "^0.
|
|
41
|
+
"@web/dev-server": "^0.2",
|
|
42
42
|
"chai": "^4",
|
|
43
|
-
"concurrently": "^
|
|
43
|
+
"concurrently": "^8",
|
|
44
44
|
"eslint": "^8",
|
|
45
|
-
"eslint-config-brightspace": "^0.
|
|
45
|
+
"eslint-config-brightspace": "^0.21",
|
|
46
46
|
"http-server": "^14.0",
|
|
47
47
|
"mocha": "^10",
|
|
48
48
|
"mocha-headless-chrome": "^4"
|