@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.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)
|
|
@@ -234,11 +234,7 @@
|
|
|
234
234
|
if (isNaN(value)) {
|
|
235
235
|
throw new ArithmeticException('Invalid int value, using NaN as argument');
|
|
236
236
|
}
|
|
237
|
-
if (Number.isInteger) {
|
|
238
|
-
if (!Number.isInteger(Number(value))) {
|
|
239
|
-
throw new ArithmeticException("Invalid value: '" + value + "' is a float");
|
|
240
|
-
}
|
|
241
|
-
} else if (value % 1 !== 0) {
|
|
237
|
+
if (!Number.isInteger(Number(value))) {
|
|
242
238
|
throw new ArithmeticException("Invalid value: '" + value + "' is a float");
|
|
243
239
|
}
|
|
244
240
|
if (value > MAX_SAFE_INTEGER || value < MIN_SAFE_INTEGER) {
|
|
@@ -737,6 +733,18 @@
|
|
|
737
733
|
totalNanos = MathUtil.safeAdd(totalNanos, this._nanos);
|
|
738
734
|
return totalNanos;
|
|
739
735
|
};
|
|
736
|
+
_proto.toHoursPart = function toHoursPart() {
|
|
737
|
+
return MathUtil.intMod(this.toHours(), LocalTime.HOURS_PER_DAY);
|
|
738
|
+
};
|
|
739
|
+
_proto.toMinutesPart = function toMinutesPart() {
|
|
740
|
+
return MathUtil.intMod(this.toMinutes(), LocalTime.MINUTES_PER_HOUR);
|
|
741
|
+
};
|
|
742
|
+
_proto.toSecondsPart = function toSecondsPart() {
|
|
743
|
+
return MathUtil.intMod(this._seconds, LocalTime.SECONDS_PER_MINUTE);
|
|
744
|
+
};
|
|
745
|
+
_proto.toMillisPart = function toMillisPart() {
|
|
746
|
+
return MathUtil.intDiv(this._nanos, 1000000);
|
|
747
|
+
};
|
|
740
748
|
_proto.compareTo = function compareTo(otherDuration) {
|
|
741
749
|
requireNonNull(otherDuration, 'otherDuration');
|
|
742
750
|
requireInstance(otherDuration, Duration, 'otherDuration');
|
|
@@ -4408,8 +4416,8 @@
|
|
|
4408
4416
|
|
|
4409
4417
|
var ZoneRulesProvider = function () {
|
|
4410
4418
|
function ZoneRulesProvider() {}
|
|
4411
|
-
ZoneRulesProvider.getRules = function getRules(
|
|
4412
|
-
throw new DateTimeException(
|
|
4419
|
+
ZoneRulesProvider.getRules = function getRules(_zoneId) {
|
|
4420
|
+
throw new DateTimeException('@js-joda/timezone not imported');
|
|
4413
4421
|
};
|
|
4414
4422
|
ZoneRulesProvider.getAvailableZoneIds = function getAvailableZoneIds() {
|
|
4415
4423
|
return [];
|
|
@@ -10412,12 +10420,7 @@
|
|
|
10412
10420
|
}
|
|
10413
10421
|
requireNonNull(date, 'date');
|
|
10414
10422
|
requireNonNull(zone, 'zone');
|
|
10415
|
-
|
|
10416
|
-
return Instant.ofEpochMilli(date.getTime()).atZone(zone);
|
|
10417
|
-
} else if (typeof date.toDate === 'function' && date.toDate() instanceof Date) {
|
|
10418
|
-
return Instant.ofEpochMilli(date.toDate().getTime()).atZone(zone);
|
|
10419
|
-
}
|
|
10420
|
-
throw new IllegalArgumentException('date must be a javascript Date or a moment instance');
|
|
10423
|
+
return Instant.ofEpochMilli(date.valueOf()).atZone(zone);
|
|
10421
10424
|
}
|
|
10422
10425
|
|
|
10423
10426
|
function bindUse(jsJoda) {
|