@js-joda/core 5.6.5 → 6.0.0
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/dist/js-joda.cjs.js +17 -14
- package/dist/js-joda.cjs.js.map +1 -1
- package/dist/js-joda.esm.js +17 -14
- package/dist/js-joda.esm.js.map +1 -1
- package/dist/js-joda.js +17 -14
- package/dist/js-joda.js.map +1 -1
- package/dist/js-joda.min.js +2 -2
- package/package.json +2 -3
- package/src/Duration.js +63 -0
- package/src/MathUtil.js +1 -5
- package/src/nativeJs.js +2 -8
- package/src/zone/ZoneRulesProvider.js +5 -3
- package/typings/js-joda.d.ts +4 -0
- package/typings/js-joda.flow.js +4 -0
package/dist/js-joda.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//! @version @js-joda/core -
|
|
1
|
+
//! @version @js-joda/core - 6.0.0
|
|
2
2
|
//! @copyright (c) 2015-present, Philipp Thürwächter, Pattrick Hüper & js-joda contributors
|
|
3
3
|
//! @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
|
|
4
4
|
//! @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
@@ -228,11 +228,7 @@ var MathUtil = function () {
|
|
|
228
228
|
if (isNaN(value)) {
|
|
229
229
|
throw new ArithmeticException('Invalid int value, using NaN as argument');
|
|
230
230
|
}
|
|
231
|
-
if (Number.isInteger) {
|
|
232
|
-
if (!Number.isInteger(Number(value))) {
|
|
233
|
-
throw new ArithmeticException("Invalid value: '" + value + "' is a float");
|
|
234
|
-
}
|
|
235
|
-
} else if (value % 1 !== 0) {
|
|
231
|
+
if (!Number.isInteger(Number(value))) {
|
|
236
232
|
throw new ArithmeticException("Invalid value: '" + value + "' is a float");
|
|
237
233
|
}
|
|
238
234
|
if (value > MAX_SAFE_INTEGER || value < MIN_SAFE_INTEGER) {
|
|
@@ -731,6 +727,18 @@ var Duration = function (_TemporalAmount) {
|
|
|
731
727
|
totalNanos = MathUtil.safeAdd(totalNanos, this._nanos);
|
|
732
728
|
return totalNanos;
|
|
733
729
|
};
|
|
730
|
+
_proto.toHoursPart = function toHoursPart() {
|
|
731
|
+
return MathUtil.intMod(this.toHours(), LocalTime.HOURS_PER_DAY);
|
|
732
|
+
};
|
|
733
|
+
_proto.toMinutesPart = function toMinutesPart() {
|
|
734
|
+
return MathUtil.intMod(this.toMinutes(), LocalTime.MINUTES_PER_HOUR);
|
|
735
|
+
};
|
|
736
|
+
_proto.toSecondsPart = function toSecondsPart() {
|
|
737
|
+
return MathUtil.intMod(this._seconds, LocalTime.SECONDS_PER_MINUTE);
|
|
738
|
+
};
|
|
739
|
+
_proto.toMillisPart = function toMillisPart() {
|
|
740
|
+
return MathUtil.intDiv(this._nanos, 1000000);
|
|
741
|
+
};
|
|
734
742
|
_proto.compareTo = function compareTo(otherDuration) {
|
|
735
743
|
requireNonNull(otherDuration, 'otherDuration');
|
|
736
744
|
requireInstance(otherDuration, Duration, 'otherDuration');
|
|
@@ -4402,8 +4410,8 @@ var StringLiteralPrinterParser = function () {
|
|
|
4402
4410
|
|
|
4403
4411
|
var ZoneRulesProvider = function () {
|
|
4404
4412
|
function ZoneRulesProvider() {}
|
|
4405
|
-
ZoneRulesProvider.getRules = function getRules(
|
|
4406
|
-
throw new DateTimeException(
|
|
4413
|
+
ZoneRulesProvider.getRules = function getRules(_zoneId) {
|
|
4414
|
+
throw new DateTimeException('@js-joda/timezone not imported');
|
|
4407
4415
|
};
|
|
4408
4416
|
ZoneRulesProvider.getAvailableZoneIds = function getAvailableZoneIds() {
|
|
4409
4417
|
return [];
|
|
@@ -10406,12 +10414,7 @@ function nativeJs(date, zone) {
|
|
|
10406
10414
|
}
|
|
10407
10415
|
requireNonNull(date, 'date');
|
|
10408
10416
|
requireNonNull(zone, 'zone');
|
|
10409
|
-
|
|
10410
|
-
return Instant.ofEpochMilli(date.getTime()).atZone(zone);
|
|
10411
|
-
} else if (typeof date.toDate === 'function' && date.toDate() instanceof Date) {
|
|
10412
|
-
return Instant.ofEpochMilli(date.toDate().getTime()).atZone(zone);
|
|
10413
|
-
}
|
|
10414
|
-
throw new IllegalArgumentException('date must be a javascript Date or a moment instance');
|
|
10417
|
+
return Instant.ofEpochMilli(date.valueOf()).atZone(zone);
|
|
10415
10418
|
}
|
|
10416
10419
|
|
|
10417
10420
|
function bindUse(jsJoda) {
|