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