@formatjs/intl-datetimeformat 1.3.2 → 1.3.3
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/CHANGELOG.md +11 -0
- package/dist/core.d.ts.map +1 -1
- package/dist/core.js +13 -27
- package/dist/core.js.map +1 -1
- package/dist/polyfill-with-locales-for-test262.min.js +19 -34
- package/dist/polyfill-with-locales-for-test262.min.js.map +1 -1
- package/dist/umd/intl-datetimeformat.js +13 -27
- package/dist/umd/intl-datetimeformat.js.map +1 -1
- package/dist/umd/intl-datetimeformat.min.js +1 -1
- package/dist/umd/intl-datetimeformat.min.js.map +1 -1
- package/dist/umd/polyfill.js +13 -27
- package/dist/umd/polyfill.js.map +1 -1
- package/lib/core.d.ts.map +1 -1
- package/lib/core.js +13 -27
- package/lib/core.js.map +1 -1
- package/package.json +7 -6
- package/src/core.ts +14 -27
- package/dist/umd/polyfill-with-locales.js +0 -1645
- package/dist/umd/polyfill-with-locales.js.map +0 -1
package/dist/umd/polyfill.js
CHANGED
|
@@ -1335,6 +1335,15 @@
|
|
|
1335
1335
|
return partitionDateTimePattern(dtf, x);
|
|
1336
1336
|
}
|
|
1337
1337
|
var MS_PER_DAY = 86400000;
|
|
1338
|
+
/**
|
|
1339
|
+
* https://www.ecma-international.org/ecma-262/11.0/index.html#eqn-modulo
|
|
1340
|
+
* @param x
|
|
1341
|
+
* @param y
|
|
1342
|
+
* @return k of the same sign as y
|
|
1343
|
+
*/
|
|
1344
|
+
function mod(x, y) {
|
|
1345
|
+
return x - Math.floor(x / y) * y;
|
|
1346
|
+
}
|
|
1338
1347
|
/**
|
|
1339
1348
|
* https://tc39.es/ecma262/#eqn-Day
|
|
1340
1349
|
* @param t
|
|
@@ -1347,7 +1356,7 @@
|
|
|
1347
1356
|
* @param t
|
|
1348
1357
|
*/
|
|
1349
1358
|
function weekDay(t) {
|
|
1350
|
-
return (day(t) + 4
|
|
1359
|
+
return mod(day(t) + 4, 7);
|
|
1351
1360
|
}
|
|
1352
1361
|
function dayFromYear(y) {
|
|
1353
1362
|
return (365 * (y - 1970) +
|
|
@@ -1474,36 +1483,13 @@
|
|
|
1474
1483
|
var MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;
|
|
1475
1484
|
var MS_PER_HOUR = MS_PER_MINUTE * MINUTES_PER_HOUR;
|
|
1476
1485
|
function hourFromTime(t) {
|
|
1477
|
-
|
|
1478
|
-
// Technically mod should return positive if y is positive
|
|
1479
|
-
// per https://tc39.es/ecma262/#eqn-modulo but it doesn't...
|
|
1480
|
-
if (objectIs(hour, -0)) {
|
|
1481
|
-
return 0;
|
|
1482
|
-
}
|
|
1483
|
-
if (hour < 0) {
|
|
1484
|
-
return 24 + hour;
|
|
1485
|
-
}
|
|
1486
|
-
return hour;
|
|
1486
|
+
return mod(Math.floor(t / MS_PER_HOUR), HOURS_PER_DAY);
|
|
1487
1487
|
}
|
|
1488
1488
|
function minFromTime(t) {
|
|
1489
|
-
|
|
1490
|
-
if (objectIs(mins, -0)) {
|
|
1491
|
-
return 0;
|
|
1492
|
-
}
|
|
1493
|
-
if (mins < 0) {
|
|
1494
|
-
return 60 + mins;
|
|
1495
|
-
}
|
|
1496
|
-
return mins;
|
|
1489
|
+
return mod(Math.floor(t / MS_PER_MINUTE), MINUTES_PER_HOUR);
|
|
1497
1490
|
}
|
|
1498
1491
|
function secFromTime(t) {
|
|
1499
|
-
|
|
1500
|
-
if (objectIs(secs, -0)) {
|
|
1501
|
-
return 0;
|
|
1502
|
-
}
|
|
1503
|
-
if (secs < 0) {
|
|
1504
|
-
return 60 + secs;
|
|
1505
|
-
}
|
|
1506
|
-
return secs;
|
|
1492
|
+
return mod(Math.floor(t / MS_PER_SECOND), SECONDS_PER_MINUTE);
|
|
1507
1493
|
}
|
|
1508
1494
|
function getApplicableZoneData(t, timeZone) {
|
|
1509
1495
|
var tzData = DateTimeFormat.tzData;
|