@js-joda/core 5.3.1 → 5.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@js-joda/core",
3
- "version": "5.3.1",
3
+ "version": "5.4.0",
4
4
  "description": "a date and time library for javascript",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,5 +48,5 @@
48
48
  "sourceMap": false,
49
49
  "instrument": false
50
50
  },
51
- "gitHead": "a1ba3e5d59b29185156e61ffc03818c2db11291a"
51
+ "gitHead": "6c4e14fdb41e71dbb23adc929730033e4caa15a4"
52
52
  }
package/src/OffsetTime.js CHANGED
@@ -443,12 +443,12 @@ export class OffsetTime extends Temporal {
443
443
  const nanosUntil = end._toEpochNano() - this._toEpochNano(); // no overflow
444
444
  switch (unit) {
445
445
  case ChronoUnit.NANOS: return nanosUntil;
446
- case ChronoUnit.MICROS: return Math.floor(nanosUntil / 1000);
447
- case ChronoUnit.MILLIS: return Math.floor(nanosUntil / 1000000);
448
- case ChronoUnit.SECONDS: return Math.floor(nanosUntil / LocalTime.NANOS_PER_SECOND);
449
- case ChronoUnit.MINUTES: return Math.floor(nanosUntil / LocalTime.NANOS_PER_MINUTE);
450
- case ChronoUnit.HOURS: return Math.floor(nanosUntil / LocalTime.NANOS_PER_HOUR);
451
- case ChronoUnit.HALF_DAYS: return Math.floor(nanosUntil / (12 * LocalTime.NANOS_PER_HOUR));
446
+ case ChronoUnit.MICROS: return MathUtil.intDiv(nanosUntil, 1000);
447
+ case ChronoUnit.MILLIS: return MathUtil.intDiv(nanosUntil, 1000000);
448
+ case ChronoUnit.SECONDS: return MathUtil.intDiv(nanosUntil, LocalTime.NANOS_PER_SECOND);
449
+ case ChronoUnit.MINUTES: return MathUtil.intDiv(nanosUntil, LocalTime.NANOS_PER_MINUTE);
450
+ case ChronoUnit.HOURS: return MathUtil.intDiv(nanosUntil, LocalTime.NANOS_PER_HOUR);
451
+ case ChronoUnit.HALF_DAYS: return MathUtil.intDiv(nanosUntil, (12 * LocalTime.NANOS_PER_HOUR));
452
452
  }
453
453
  throw new UnsupportedTemporalTypeException(`Unsupported unit: ${unit}`);
454
454
  }
package/src/YearMonth.js CHANGED
@@ -851,10 +851,10 @@ export class YearMonth extends Temporal {
851
851
  const monthsUntil = end._getProlepticMonth() - this._getProlepticMonth(); // no overflow
852
852
  switch (unit) {
853
853
  case ChronoUnit.MONTHS: return monthsUntil;
854
- case ChronoUnit.YEARS: return monthsUntil / 12;
855
- case ChronoUnit.DECADES: return monthsUntil / 120;
856
- case ChronoUnit.CENTURIES: return monthsUntil / 1200;
857
- case ChronoUnit.MILLENNIA: return monthsUntil / 12000;
854
+ case ChronoUnit.YEARS: return MathUtil.intDiv(monthsUntil, 12);
855
+ case ChronoUnit.DECADES: return MathUtil.intDiv(monthsUntil, 120);
856
+ case ChronoUnit.CENTURIES: return MathUtil.intDiv(monthsUntil, 1200);
857
+ case ChronoUnit.MILLENNIA: return MathUtil.intDiv(monthsUntil, 12000);
858
858
  case ChronoUnit.ERAS: return end.getLong(ChronoField.ERA) - this.getLong(ChronoField.ERA);
859
859
  }
860
860
  throw new UnsupportedTemporalTypeException(`Unsupported unit: ${unit}`);
package/src/js-joda.js CHANGED
@@ -150,7 +150,7 @@ const jsJodaExports = {
150
150
  /**
151
151
  * @private
152
152
  *
153
- * @type {function(*=): *}
153
+ * @type { function(function(jsJoda: JsJoda) }
154
154
  */
155
155
  const use = bindUse(jsJodaExports);
156
156
  jsJodaExports.use = use;
@@ -321,7 +321,7 @@ export class ChronoField extends TemporalField {
321
321
  this === ChronoField.ALIGNED_WEEK_OF_MONTH ||
322
322
  this === ChronoField.ALIGNED_WEEK_OF_YEAR ||
323
323
  this === ChronoField.MONTH_OF_YEAR ||
324
- //this === ChronoField.EPOCH_MONTH ||
324
+ this === ChronoField.PROLEPTIC_MONTH ||
325
325
  this === ChronoField.YEAR_OF_ERA ||
326
326
  this === ChronoField.YEAR ||
327
327
  this === ChronoField.ERA;
@@ -447,7 +447,7 @@ export function _init() {
447
447
 
448
448
  ChronoField.DAY_OF_YEAR = new ChronoField('DayOfYear', ChronoUnit.DAYS, ChronoUnit.YEARS, ValueRange.of(1, 365, 366));
449
449
 
450
- ChronoField.EPOCH_DAY = new ChronoField('EpochDay', ChronoUnit.DAYS, ChronoUnit.FOREVER, ValueRange.of(Math.floor(YearConstants.MIN_VALUE * 365.25), Math.floor(YearConstants.MAX_VALUE * 365.25)));
450
+ ChronoField.EPOCH_DAY = new ChronoField('EpochDay', ChronoUnit.DAYS, ChronoUnit.FOREVER, ValueRange.of(-365961662, 364522971)); // [LocalDate.MIN.toEpochDay() .. LocalDate.MAX.toEpochDay()]
451
451
 
452
452
  ChronoField.ALIGNED_WEEK_OF_MONTH = new ChronoField('AlignedWeekOfMonth', ChronoUnit.WEEKS, ChronoUnit.MONTHS, ValueRange.of(1, 4, 5));
453
453
 
package/src/use.js CHANGED
@@ -2,7 +2,7 @@
2
2
  * @private
3
3
  *
4
4
  * @param jsJoda
5
- * @returns {function(*=): *}
5
+ * @returns { function(jsJoda: JsJoda) }
6
6
  */
7
7
  export function bindUse(jsJoda) {
8
8
  const used = [];