@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.
@@ -1,4 +1,4 @@
1
- //! @version @js-joda/core - 5.6.5
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)
@@ -230,11 +230,7 @@ var MathUtil = function () {
230
230
  if (isNaN(value)) {
231
231
  throw new ArithmeticException('Invalid int value, using NaN as argument');
232
232
  }
233
- if (Number.isInteger) {
234
- if (!Number.isInteger(Number(value))) {
235
- throw new ArithmeticException("Invalid value: '" + value + "' is a float");
236
- }
237
- } else if (value % 1 !== 0) {
233
+ if (!Number.isInteger(Number(value))) {
238
234
  throw new ArithmeticException("Invalid value: '" + value + "' is a float");
239
235
  }
240
236
  if (value > MAX_SAFE_INTEGER || value < MIN_SAFE_INTEGER) {
@@ -733,6 +729,18 @@ var Duration = function (_TemporalAmount) {
733
729
  totalNanos = MathUtil.safeAdd(totalNanos, this._nanos);
734
730
  return totalNanos;
735
731
  };
732
+ _proto.toHoursPart = function toHoursPart() {
733
+ return MathUtil.intMod(this.toHours(), LocalTime.HOURS_PER_DAY);
734
+ };
735
+ _proto.toMinutesPart = function toMinutesPart() {
736
+ return MathUtil.intMod(this.toMinutes(), LocalTime.MINUTES_PER_HOUR);
737
+ };
738
+ _proto.toSecondsPart = function toSecondsPart() {
739
+ return MathUtil.intMod(this._seconds, LocalTime.SECONDS_PER_MINUTE);
740
+ };
741
+ _proto.toMillisPart = function toMillisPart() {
742
+ return MathUtil.intDiv(this._nanos, 1000000);
743
+ };
736
744
  _proto.compareTo = function compareTo(otherDuration) {
737
745
  requireNonNull(otherDuration, 'otherDuration');
738
746
  requireInstance(otherDuration, Duration, 'otherDuration');
@@ -4404,8 +4412,8 @@ var StringLiteralPrinterParser = function () {
4404
4412
 
4405
4413
  var ZoneRulesProvider = function () {
4406
4414
  function ZoneRulesProvider() {}
4407
- ZoneRulesProvider.getRules = function getRules(zoneId) {
4408
- throw new DateTimeException("unsupported ZoneId:" + zoneId);
4415
+ ZoneRulesProvider.getRules = function getRules(_zoneId) {
4416
+ throw new DateTimeException('@js-joda/timezone not imported');
4409
4417
  };
4410
4418
  ZoneRulesProvider.getAvailableZoneIds = function getAvailableZoneIds() {
4411
4419
  return [];
@@ -10408,12 +10416,7 @@ function nativeJs(date, zone) {
10408
10416
  }
10409
10417
  requireNonNull(date, 'date');
10410
10418
  requireNonNull(zone, 'zone');
10411
- if (date instanceof Date) {
10412
- return Instant.ofEpochMilli(date.getTime()).atZone(zone);
10413
- } else if (typeof date.toDate === 'function' && date.toDate() instanceof Date) {
10414
- return Instant.ofEpochMilli(date.toDate().getTime()).atZone(zone);
10415
- }
10416
- throw new IllegalArgumentException('date must be a javascript Date or a moment instance');
10419
+ return Instant.ofEpochMilli(date.valueOf()).atZone(zone);
10417
10420
  }
10418
10421
 
10419
10422
  function bindUse(jsJoda) {