@js-joda/extra 0.13.0 → 0.13.1

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/extra - 0.13.0
1
+ //! @version @js-joda/extra - 0.13.1
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)
@@ -9,17 +9,13 @@
9
9
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.JSJodaExtra = {}, global.JSJoda));
10
10
  })(this, (function (exports, core) { 'use strict';
11
11
 
12
- function _inheritsLoose(subClass, superClass) {
13
- subClass.prototype = Object.create(superClass.prototype);
14
- subClass.prototype.constructor = subClass;
15
- _setPrototypeOf(subClass, superClass);
12
+ function _inheritsLoose(t, o) {
13
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
16
14
  }
17
- function _setPrototypeOf(o, p) {
18
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
19
- o.__proto__ = p;
20
- return o;
21
- };
22
- return _setPrototypeOf(o, p);
15
+ function _setPrototypeOf(t, e) {
16
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) {
17
+ return t.__proto__ = e, t;
18
+ }, _setPrototypeOf(t, e);
23
19
  }
24
20
 
25
21
  /**
@@ -50,6 +46,12 @@
50
46
 
51
47
  var MathUtil$6 = core._.MathUtil;
52
48
  var DayOfMonth = function (_TemporalAccessor) {
49
+ function DayOfMonth(dayOfMonth) {
50
+ var _this;
51
+ _this = _TemporalAccessor.call(this) || this;
52
+ _this._day = MathUtil$6.safeToInt(dayOfMonth);
53
+ return _this;
54
+ }
53
55
  _inheritsLoose(DayOfMonth, _TemporalAccessor);
54
56
  DayOfMonth.now = function now(zoneIdOrClock) {
55
57
  switch (arguments.length) {
@@ -96,12 +98,6 @@
96
98
  throw new core.DateTimeException("Unable to obtain DayOfMonth from TemporalAccessor: " + temporal + " of type " + temporal.constructor.name, ex);
97
99
  }
98
100
  };
99
- function DayOfMonth(dayOfMonth) {
100
- var _this;
101
- _this = _TemporalAccessor.call(this) || this;
102
- _this._day = MathUtil$6.safeToInt(dayOfMonth);
103
- return _this;
104
- }
105
101
  var _proto = DayOfMonth.prototype;
106
102
  _proto.value = function value() {
107
103
  return this._day;
@@ -189,6 +185,12 @@
189
185
 
190
186
  var MathUtil$5 = core._.MathUtil;
191
187
  var DayOfYear = function (_TemporalAccessor) {
188
+ function DayOfYear(dayOfYear) {
189
+ var _this;
190
+ _this = _TemporalAccessor.call(this) || this;
191
+ _this._day = MathUtil$5.safeToInt(dayOfYear);
192
+ return _this;
193
+ }
192
194
  _inheritsLoose(DayOfYear, _TemporalAccessor);
193
195
  DayOfYear.now = function now(zoneIdOrClock) {
194
196
  switch (arguments.length) {
@@ -236,12 +238,6 @@
236
238
  throw new core.DateTimeException("Unable to obtain DayOfYear from TemporalAccessor: " + temporal + " of type " + temporal.constructor.name, ex);
237
239
  }
238
240
  };
239
- function DayOfYear(dayOfYear) {
240
- var _this;
241
- _this = _TemporalAccessor.call(this) || this;
242
- _this._day = MathUtil$5.safeToInt(dayOfYear);
243
- return _this;
244
- }
245
241
  var _proto = DayOfYear.prototype;
246
242
  _proto.value = function value() {
247
243
  return this._day;
@@ -330,6 +326,10 @@
330
326
  */
331
327
 
332
328
  var Interval = function () {
329
+ function Interval(startInclusive, endExclusive) {
330
+ this._start = startInclusive;
331
+ this._end = endExclusive;
332
+ }
333
333
  Interval.of = function of(startInstant, endInstantOrDuration) {
334
334
  if (endInstantOrDuration instanceof core.Duration) {
335
335
  return Interval.ofInstantDuration(startInstant, endInstantOrDuration);
@@ -385,10 +385,6 @@
385
385
  }
386
386
  throw new core.DateTimeParseException('Interval cannot be parsed, no forward slash found', text, 0);
387
387
  };
388
- function Interval(startInclusive, endExclusive) {
389
- this._start = startInclusive;
390
- this._end = endExclusive;
391
- }
392
388
  var _proto = Interval.prototype;
393
389
  _proto.start = function start() {
394
390
  return this._start;
@@ -540,6 +536,26 @@
540
536
  var MINP1 = core.LocalDate.MIN.plusDays(1);
541
537
  var MAXM1 = core.LocalDate.MAX.minusDays(1);
542
538
  var LocalDateRange = function () {
539
+ function LocalDateRange(startInclusive, endExclusive) {
540
+ requireNonNull(startInclusive, 'startInclusive');
541
+ requireNonNull(endExclusive, 'endExclusive');
542
+ requireInstance(startInclusive, core.LocalDate, 'startInclusive');
543
+ requireInstance(endExclusive, core.LocalDate, 'endExclusive');
544
+ if (endExclusive.isBefore(startInclusive)) {
545
+ throw new core.DateTimeException('End date must be on or after start date');
546
+ }
547
+ if (startInclusive.equals(MAXM1)) {
548
+ throw new core.DateTimeException('Range must not start at LocalDate.MAX.minusDays(1)');
549
+ }
550
+ if (endExclusive.equals(MINP1)) {
551
+ throw new core.DateTimeException('Range must not end at LocalDate.MIN.plusDays(1)');
552
+ }
553
+ if (endExclusive.equals(core.LocalDate.MIN) || startInclusive.equals(core.LocalDate.MAX)) {
554
+ throw new core.DateTimeException('Empty range must not be at LocalDate.MIN or LocalDate.MAX');
555
+ }
556
+ this._start = startInclusive;
557
+ this._end = endExclusive;
558
+ }
543
559
  LocalDateRange.of = function of(startInclusive, endExclusiveOrPeriod) {
544
560
  if (startInclusive instanceof core.LocalDate && endExclusiveOrPeriod instanceof core.LocalDate) {
545
561
  return LocalDateRange._ofLocalDateLocalDate(startInclusive, endExclusiveOrPeriod);
@@ -625,26 +641,6 @@
625
641
  }
626
642
  throw new core.DateTimeParseException('LocalDateRange cannot be parsed, no forward slash found', text, 0);
627
643
  };
628
- function LocalDateRange(startInclusive, endExclusive) {
629
- requireNonNull(startInclusive, 'startInclusive');
630
- requireNonNull(endExclusive, 'endExclusive');
631
- requireInstance(startInclusive, core.LocalDate, 'startInclusive');
632
- requireInstance(endExclusive, core.LocalDate, 'endExclusive');
633
- if (endExclusive.isBefore(startInclusive)) {
634
- throw new core.DateTimeException('End date must be on or after start date');
635
- }
636
- if (startInclusive.equals(MAXM1)) {
637
- throw new core.DateTimeException('Range must not start at LocalDate.MAX.minusDays(1)');
638
- }
639
- if (endExclusive.equals(MINP1)) {
640
- throw new core.DateTimeException('Range must not end at LocalDate.MIN.plusDays(1)');
641
- }
642
- if (endExclusive.equals(core.LocalDate.MIN) || startInclusive.equals(core.LocalDate.MAX)) {
643
- throw new core.DateTimeException('Empty range must not be at LocalDate.MIN or LocalDate.MAX');
644
- }
645
- this._start = startInclusive;
646
- this._end = endExclusive;
647
- }
648
644
  var _proto = LocalDateRange.prototype;
649
645
  _proto.start = function start() {
650
646
  return this._start;
@@ -802,6 +798,13 @@
802
798
  var MathUtil$4 = core._.MathUtil;
803
799
  var SECONDS_PER_DAY = 86400;
804
800
  var OffsetDate = function (_Temporal) {
801
+ function OffsetDate(date, offset) {
802
+ var _this;
803
+ _this = _Temporal.call(this) || this;
804
+ _this._date = requireNonNull(date, 'date');
805
+ _this._offset = requireNonNull(offset, 'offset');
806
+ return _this;
807
+ }
805
808
  _inheritsLoose(OffsetDate, _Temporal);
806
809
  OffsetDate.now = function now(zoneIdOrClock) {
807
810
  if (arguments.length === 0) {
@@ -870,13 +873,6 @@
870
873
  requireNonNull(formatter, 'formatter');
871
874
  return formatter.parse(text, OffsetDate.FROM);
872
875
  };
873
- function OffsetDate(date, offset) {
874
- var _this;
875
- _this = _Temporal.call(this) || this;
876
- _this._date = requireNonNull(date, 'date');
877
- _this._offset = requireNonNull(offset, 'offset');
878
- return _this;
879
- }
880
876
  var _proto = OffsetDate.prototype;
881
877
  _proto._with = function _with(date, offset) {
882
878
  if (this._date === date && this._offset.equals(offset)) {
@@ -1121,10 +1117,10 @@
1121
1117
  }
1122
1118
  function createTemporalQuery$3(name, queryFromFunction) {
1123
1119
  var ExtendedTemporalQuery = function (_TemporalQuery) {
1124
- _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
1125
1120
  function ExtendedTemporalQuery() {
1126
1121
  return _TemporalQuery.apply(this, arguments) || this;
1127
1122
  }
1123
+ _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
1128
1124
  return ExtendedTemporalQuery;
1129
1125
  }(core.TemporalQuery);
1130
1126
  ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
@@ -1133,6 +1129,13 @@
1133
1129
 
1134
1130
  var MathUtil$3 = core._.MathUtil;
1135
1131
  var Quarter = function (_TemporalAccessor) {
1132
+ function Quarter(value, name) {
1133
+ var _this;
1134
+ _this = _TemporalAccessor.call(this) || this;
1135
+ _this._value = MathUtil$3.safeToInt(value);
1136
+ _this._name = name;
1137
+ return _this;
1138
+ }
1136
1139
  _inheritsLoose(Quarter, _TemporalAccessor);
1137
1140
  Quarter.valueOf = function valueOf(name) {
1138
1141
  requireNonNull(name, 'name');
@@ -1185,13 +1188,6 @@
1185
1188
  throw new core.DateTimeException("Unable to obtain Quarter from TemporalAccessor: '" + temporal + "' of type '" + (temporal && temporal.constructor.name) + "'", ex);
1186
1189
  }
1187
1190
  };
1188
- function Quarter(value, name) {
1189
- var _this;
1190
- _this = _TemporalAccessor.call(this) || this;
1191
- _this._value = MathUtil$3.safeToInt(value);
1192
- _this._name = name;
1193
- return _this;
1194
- }
1195
1191
  var _proto = Quarter.prototype;
1196
1192
  _proto.value = function value() {
1197
1193
  return this._value;
@@ -1310,10 +1306,10 @@
1310
1306
  }
1311
1307
  function createTemporalQuery$2(name, queryFromFunction) {
1312
1308
  var ExtendedTemporalQuery = function (_TemporalQuery) {
1313
- _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
1314
1309
  function ExtendedTemporalQuery() {
1315
1310
  return _TemporalQuery.apply(this, arguments) || this;
1316
1311
  }
1312
+ _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
1317
1313
  return ExtendedTemporalQuery;
1318
1314
  }(core.TemporalQuery);
1319
1315
  ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
@@ -1322,6 +1318,7 @@
1322
1318
 
1323
1319
  var MathUtil$2 = core._.MathUtil;
1324
1320
  var Temporals = function () {
1321
+ function Temporals() {}
1325
1322
  Temporals.nextWorkingDay = function nextWorkingDay() {
1326
1323
  return Adjuster.NEXT_WORKING;
1327
1324
  };
@@ -1420,16 +1417,15 @@
1420
1417
  }
1421
1418
  return 3;
1422
1419
  };
1423
- function Temporals() {}
1424
1420
  return Temporals;
1425
1421
  }();
1426
1422
  var Adjuster = {};
1427
1423
  function _init$2() {
1428
1424
  Adjuster.NEXT_WORKING = new (function (_TemporalAdjuster) {
1429
- _inheritsLoose(_class, _TemporalAdjuster);
1430
1425
  function _class() {
1431
1426
  return _TemporalAdjuster.apply(this, arguments) || this;
1432
1427
  }
1428
+ _inheritsLoose(_class, _TemporalAdjuster);
1433
1429
  var _proto = _class.prototype;
1434
1430
  _proto.adjustInto = function adjustInto(temporal) {
1435
1431
  var dow = temporal.get(core.ChronoField.DAY_OF_WEEK);
@@ -1445,10 +1441,10 @@
1445
1441
  return _class;
1446
1442
  }(core.TemporalAdjuster))();
1447
1443
  Adjuster.PREVIOUS_WORKING = new (function (_TemporalAdjuster2) {
1448
- _inheritsLoose(_class2, _TemporalAdjuster2);
1449
1444
  function _class2() {
1450
1445
  return _TemporalAdjuster2.apply(this, arguments) || this;
1451
1446
  }
1447
+ _inheritsLoose(_class2, _TemporalAdjuster2);
1452
1448
  var _proto2 = _class2.prototype;
1453
1449
  _proto2.adjustInto = function adjustInto(temporal) {
1454
1450
  var dow = temporal.get(core.ChronoField.DAY_OF_WEEK);
@@ -1464,10 +1460,10 @@
1464
1460
  return _class2;
1465
1461
  }(core.TemporalAdjuster))();
1466
1462
  Adjuster.NEXT_WORKING_OR_SAME = new (function (_TemporalAdjuster3) {
1467
- _inheritsLoose(_class3, _TemporalAdjuster3);
1468
1463
  function _class3() {
1469
1464
  return _TemporalAdjuster3.apply(this, arguments) || this;
1470
1465
  }
1466
+ _inheritsLoose(_class3, _TemporalAdjuster3);
1471
1467
  var _proto3 = _class3.prototype;
1472
1468
  _proto3.adjustInto = function adjustInto(temporal) {
1473
1469
  var dow = temporal.get(core.ChronoField.DAY_OF_WEEK);
@@ -1483,10 +1479,10 @@
1483
1479
  return _class3;
1484
1480
  }(core.TemporalAdjuster))();
1485
1481
  Adjuster.PREVIOUS_WORKING_OR_SAME = new (function (_TemporalAdjuster4) {
1486
- _inheritsLoose(_class4, _TemporalAdjuster4);
1487
1482
  function _class4() {
1488
1483
  return _TemporalAdjuster4.apply(this, arguments) || this;
1489
1484
  }
1485
+ _inheritsLoose(_class4, _TemporalAdjuster4);
1490
1486
  var _proto4 = _class4.prototype;
1491
1487
  _proto4.adjustInto = function adjustInto(temporal) {
1492
1488
  var dow = temporal.get(core.ChronoField.DAY_OF_WEEK);
@@ -1505,6 +1501,13 @@
1505
1501
 
1506
1502
  var MathUtil$1 = core._.MathUtil;
1507
1503
  var YearQuarter = function (_Temporal) {
1504
+ function YearQuarter(year, quarter) {
1505
+ var _this;
1506
+ _this = _Temporal.call(this) || this;
1507
+ _this._year = MathUtil$1.safeToInt(year);
1508
+ _this._quarter = requireInstance(quarter, Quarter, 'Quarter');
1509
+ return _this;
1510
+ }
1508
1511
  _inheritsLoose(YearQuarter, _Temporal);
1509
1512
  YearQuarter.now = function now(zoneIdOrClock) {
1510
1513
  if (arguments.length === 0) {
@@ -1578,13 +1581,6 @@
1578
1581
  requireInstance(formatter, core.DateTimeFormatter, 'formatter');
1579
1582
  return formatter.parse(text, YearQuarter.FROM);
1580
1583
  };
1581
- function YearQuarter(year, quarter) {
1582
- var _this;
1583
- _this = _Temporal.call(this) || this;
1584
- _this._year = MathUtil$1.safeToInt(year);
1585
- _this._quarter = requireInstance(quarter, Quarter, 'Quarter');
1586
- return _this;
1587
- }
1588
1584
  var _proto = YearQuarter.prototype;
1589
1585
  _proto._with = function _with(newYear, newQuarter) {
1590
1586
  if (this._year === newYear && this._quarter === newQuarter) {
@@ -1872,10 +1868,10 @@
1872
1868
  }
1873
1869
  function createTemporalQuery$1(name, queryFromFunction) {
1874
1870
  var ExtendedTemporalQuery = function (_TemporalQuery) {
1875
- _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
1876
1871
  function ExtendedTemporalQuery() {
1877
1872
  return _TemporalQuery.apply(this, arguments) || this;
1878
1873
  }
1874
+ _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
1879
1875
  return ExtendedTemporalQuery;
1880
1876
  }(core.TemporalQuery);
1881
1877
  ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
@@ -1884,6 +1880,13 @@
1884
1880
 
1885
1881
  var MathUtil = core._.MathUtil;
1886
1882
  var YearWeek = function (_Temporal) {
1883
+ function YearWeek(weekBasedYear, week) {
1884
+ var _this;
1885
+ _this = _Temporal.call(this) || this;
1886
+ _this._year = weekBasedYear;
1887
+ _this._week = week;
1888
+ return _this;
1889
+ }
1887
1890
  _inheritsLoose(YearWeek, _Temporal);
1888
1891
  YearWeek.now = function now(zoneIdOrClock) {
1889
1892
  switch (arguments.length) {
@@ -1962,13 +1965,6 @@
1962
1965
  assert(formatter != null, 'formatter', core.NullPointerException);
1963
1966
  return formatter.parse(text, YearWeek.FROM);
1964
1967
  };
1965
- function YearWeek(weekBasedYear, week) {
1966
- var _this;
1967
- _this = _Temporal.call(this) || this;
1968
- _this._year = weekBasedYear;
1969
- _this._week = week;
1970
- return _this;
1971
- }
1972
1968
  var _proto = YearWeek.prototype;
1973
1969
  _proto.isSupported = function isSupported(fieldOrUnit) {
1974
1970
  if (fieldOrUnit instanceof core.TemporalField) {
@@ -2217,10 +2213,10 @@
2217
2213
  }
2218
2214
  function createTemporalQuery(name, queryFromFunction) {
2219
2215
  var ExtendedTemporalQuery = function (_TemporalQuery) {
2220
- _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
2221
2216
  function ExtendedTemporalQuery() {
2222
2217
  return _TemporalQuery.apply(this, arguments) || this;
2223
2218
  }
2219
+ _inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
2224
2220
  return ExtendedTemporalQuery;
2225
2221
  }(core.TemporalQuery);
2226
2222
  ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;