@js-joda/core 3.2.0 → 4.2.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.
Files changed (74) hide show
  1. package/CHANGELOG.md +32 -1
  2. package/README.md +43 -36
  3. package/dist/js-joda.d.ts +241 -179
  4. package/dist/js-joda.esm.js +11524 -10214
  5. package/dist/js-joda.js +11524 -10214
  6. package/dist/js-joda.js.map +1 -1
  7. package/dist/js-joda.min.js +2 -2
  8. package/package.json +10 -40
  9. package/src/Clock.js +8 -9
  10. package/src/DayOfWeek.js +14 -14
  11. package/src/Duration.js +15 -15
  12. package/src/Instant.js +40 -74
  13. package/src/LocalDate.js +71 -93
  14. package/src/LocalDateTime.js +25 -68
  15. package/src/LocalTime.js +27 -72
  16. package/src/MathUtil.js +3 -3
  17. package/src/Month.js +13 -13
  18. package/src/MonthDay.js +25 -25
  19. package/src/OffsetDateTime.js +29 -29
  20. package/src/OffsetTime.js +32 -32
  21. package/src/Period.js +12 -12
  22. package/src/StringUtil.js +1 -1
  23. package/src/Year.js +33 -115
  24. package/src/YearMonth.js +31 -113
  25. package/src/ZoneId.js +7 -7
  26. package/src/ZoneIdFactory.js +14 -14
  27. package/src/ZoneOffset.js +23 -23
  28. package/src/ZoneRegion.js +2 -2
  29. package/src/ZonedDateTime.js +31 -74
  30. package/src/_init.js +24 -24
  31. package/src/assert.js +31 -4
  32. package/src/chrono/ChronoLocalDate.js +8 -8
  33. package/src/chrono/ChronoLocalDateTime.js +10 -10
  34. package/src/chrono/ChronoZonedDateTime.js +8 -8
  35. package/src/chrono/IsoChronology.js +13 -13
  36. package/src/convert.js +12 -8
  37. package/src/errors.js +3 -3
  38. package/src/format/DateTimeBuilder.js +17 -17
  39. package/src/format/DateTimeFormatter.js +45 -24
  40. package/src/format/DateTimeFormatterBuilder.js +59 -59
  41. package/src/format/DateTimeParseContext.js +6 -6
  42. package/src/format/DateTimePrintContext.js +3 -3
  43. package/src/format/DecimalStyle.js +1 -1
  44. package/src/format/ResolverStyle.js +1 -1
  45. package/src/format/SignStyle.js +1 -1
  46. package/src/format/TextStyle.js +1 -1
  47. package/src/format/parser/CharLiteralPrinterParser.js +3 -3
  48. package/src/format/parser/FractionPrinterParser.js +10 -10
  49. package/src/format/parser/NumberPrinterParser.js +18 -18
  50. package/src/format/parser/OffsetIdPrinterParser.js +9 -9
  51. package/src/format/parser/PadPrinterParserDecorator.js +3 -3
  52. package/src/format/parser/StringLiteralPrinterParser.js +2 -2
  53. package/src/format/parser/ZoneIdPrinterParser.js +5 -5
  54. package/src/js-joda.js +5 -0
  55. package/src/temporal/ChronoField.js +5 -5
  56. package/src/temporal/ChronoUnit.js +6 -6
  57. package/src/temporal/IsoFields.js +12 -12
  58. package/src/temporal/NativeJsTemporal.js +11 -11
  59. package/src/temporal/Temporal.js +45 -38
  60. package/src/temporal/TemporalAccessor.js +14 -4
  61. package/src/temporal/TemporalAdjuster.js +1 -1
  62. package/src/temporal/TemporalAdjusters.js +6 -6
  63. package/src/temporal/TemporalAmount.js +1 -1
  64. package/src/temporal/TemporalQueriesFactory.js +6 -6
  65. package/src/temporal/TemporalQuery.js +4 -2
  66. package/src/temporal/TemporalUnit.js +1 -1
  67. package/src/temporal/ValueRange.js +15 -15
  68. package/src/use.js +6 -1
  69. package/src/zone/SystemDefaultZoneId.js +2 -2
  70. package/src/zone/SystemDefaultZoneRules.js +3 -3
  71. package/src/zone/ZoneOffsetTransition.js +7 -7
  72. package/src/zone/ZoneRules.js +4 -4
  73. package/src/zone/ZoneRulesProvider.js +2 -2
  74. package/src/temporal/DefaultInterfaceTemporal.js +0 -118
package/src/LocalDate.js CHANGED
@@ -4,33 +4,33 @@
4
4
  * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
5
  */
6
6
 
7
- import {assert, requireNonNull, requireInstance} from './assert';
8
-
9
- import {MathUtil} from './MathUtil';
10
- import {DateTimeException, UnsupportedTemporalTypeException, NullPointerException, IllegalArgumentException} from './errors';
11
-
12
- import {IsoChronology} from './chrono/IsoChronology';
13
- import {ChronoField} from './temporal/ChronoField';
14
- import {ChronoUnit} from './temporal/ChronoUnit';
15
- import {ChronoLocalDate} from './chrono/ChronoLocalDate';
16
- import {TemporalQueries} from './temporal/TemporalQueries';
17
- import {createTemporalQuery} from './temporal/TemporalQuery';
18
- import {ValueRange} from './temporal/ValueRange';
19
- import {DateTimeFormatter} from './format/DateTimeFormatter';
20
-
21
- import {Clock} from './Clock';
22
- import {DayOfWeek} from './DayOfWeek';
23
- import {OffsetDateTime} from './OffsetDateTime';
24
- import {OffsetTime} from './OffsetTime';
25
- import {Month} from './Month';
26
- import {Period} from './Period';
27
- import {YearConstants} from './YearConstants';
28
- import {LocalTime} from './LocalTime';
29
- import {LocalDateTime} from './LocalDateTime';
30
- import {Year} from './Year';
31
- import {ZoneId} from './ZoneId';
32
- import {ZoneOffset} from './ZoneOffset';
33
- import {ZonedDateTime} from './ZonedDateTime';
7
+ import { assert, requireNonNull, requireInstance } from './assert';
8
+
9
+ import { MathUtil } from './MathUtil';
10
+ import { DateTimeException, UnsupportedTemporalTypeException, NullPointerException, IllegalArgumentException } from './errors';
11
+
12
+ import { IsoChronology } from './chrono/IsoChronology';
13
+ import { ChronoField } from './temporal/ChronoField';
14
+ import { ChronoUnit } from './temporal/ChronoUnit';
15
+ import { ChronoLocalDate } from './chrono/ChronoLocalDate';
16
+ import { TemporalQueries } from './temporal/TemporalQueries';
17
+ import { createTemporalQuery } from './temporal/TemporalQuery';
18
+ import { ValueRange } from './temporal/ValueRange';
19
+ import { DateTimeFormatter } from './format/DateTimeFormatter';
20
+
21
+ import { Clock } from './Clock';
22
+ import { DayOfWeek } from './DayOfWeek';
23
+ import { OffsetDateTime } from './OffsetDateTime';
24
+ import { OffsetTime } from './OffsetTime';
25
+ import { Month } from './Month';
26
+ import { Period } from './Period';
27
+ import { YearConstants } from './YearConstants';
28
+ import { LocalTime } from './LocalTime';
29
+ import { LocalDateTime } from './LocalDateTime';
30
+ import { Year } from './Year';
31
+ import { ZoneId } from './ZoneId';
32
+ import { ZoneOffset } from './ZoneOffset';
33
+ import { ZonedDateTime } from './ZonedDateTime';
34
34
 
35
35
  /**
36
36
  * The number of days in a 400 year cycle.
@@ -158,7 +158,7 @@ export class LocalDate extends ChronoLocalDate{
158
158
  //TODO: ChronoField.DAY_OF_YEAR.checkValidValue(dayOfYear);
159
159
  const leap = IsoChronology.isLeapYear(year);
160
160
  if (dayOfYear === 366 && leap === false) {
161
- assert(false, 'Invalid date \'DayOfYear 366\' as \'' + year + '\' is not a leap year', DateTimeException);
161
+ assert(false, `Invalid date 'DayOfYear 366' as '${year}' is not a leap year`, DateTimeException);
162
162
  }
163
163
  let moy = Month.of(Math.floor((dayOfYear - 1) / 31 + 1));
164
164
  const monthEnd = moy.firstDayOfYear(leap) + moy.length(leap) - 1;
@@ -323,9 +323,9 @@ export class LocalDate extends ChronoLocalDate{
323
323
  }
324
324
  if (dayOfMonth > dom) {
325
325
  if (dayOfMonth === 29) {
326
- assert(false, 'Invalid date \'February 29\' as \'' + year + '\' is not a leap year', DateTimeException);
326
+ assert(false, `Invalid date 'February 29' as '${year}' is not a leap year`, DateTimeException);
327
327
  } else {
328
- assert(false, 'Invalid date \'' + year + '\' \'' + month + '\' \'' + dayOfMonth + '\'', DateTimeException);
328
+ assert(false, `Invalid date '${year}' '${month}' '${dayOfMonth}'`, DateTimeException);
329
329
  }
330
330
  }
331
331
  }
@@ -405,7 +405,7 @@ export class LocalDate extends ChronoLocalDate{
405
405
  }
406
406
  return field.range();
407
407
  }
408
- throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
408
+ throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
409
409
  }
410
410
  return field.rangeRefinedBy(this);
411
411
  }
@@ -476,7 +476,7 @@ export class LocalDate extends ChronoLocalDate{
476
476
  case ChronoField.YEAR: return this._year;
477
477
  case ChronoField.ERA: return (this._year >= 1 ? 1 : 0);
478
478
  }
479
- throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
479
+ throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
480
480
  }
481
481
 
482
482
  /**
@@ -651,14 +651,13 @@ export class LocalDate extends ChronoLocalDate{
651
651
  * @throws {DateTimeException} if the adjustment cannot be made
652
652
  * @throws {ArithmeticException} if numeric overflow occurs
653
653
  */
654
- withAdjuster(adjuster) {
654
+ _withAdjuster(adjuster) {
655
655
  requireNonNull(adjuster, 'adjuster');
656
656
  // optimizations
657
657
  if (adjuster instanceof LocalDate) {
658
658
  return adjuster;
659
659
  }
660
- assert(typeof adjuster.adjustInto === 'function', 'adjuster', IllegalArgumentException);
661
- return adjuster.adjustInto(this);
660
+ return super._withAdjuster(adjuster);
662
661
  }
663
662
 
664
663
  /**
@@ -761,7 +760,7 @@ export class LocalDate extends ChronoLocalDate{
761
760
  * @throws {DateTimeException} if the field cannot be set
762
761
  * @throws {ArithmeticException} if numeric overflow occurs
763
762
  */
764
- withFieldValue(field, newValue) {
763
+ _withField(field, newValue) {
765
764
  assert(field != null, 'field', NullPointerException);
766
765
  if (field instanceof ChronoField) {
767
766
  const f = field;
@@ -781,7 +780,7 @@ export class LocalDate extends ChronoLocalDate{
781
780
  case ChronoField.YEAR: return this.withYear(newValue);
782
781
  case ChronoField.ERA: return (this.getLong(ChronoField.ERA) === newValue ? this : this.withYear(1 - this._year));
783
782
  }
784
- throw new UnsupportedTemporalTypeException('Unsupported field: ' + field);
783
+ throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
785
784
  }
786
785
  return field.adjustInto(this, newValue);
787
786
  }
@@ -852,25 +851,6 @@ export class LocalDate extends ChronoLocalDate{
852
851
  return LocalDate.ofYearDay(this._year, dayOfYear);
853
852
  }
854
853
 
855
- /**
856
- * Returns a copy of this date with the specified period added.
857
- *
858
- * This method returns a new date based on this date with the specified period added.
859
- * The amount is typically {@link Period} but may be any other type implementing
860
- * the {@link TemporalAmount} interface.
861
- * The calculation is delegated to the specified adjuster, which typically calls
862
- * back to {@link LocalDate.plusAmountUnit}.
863
- *
864
- * @param {!TemporalAmount} amount - the amount to add, not null
865
- * @return {LocalDate} a {@link LocalDate} based on this date with the addition made, not null
866
- * @throws {DateTimeException} if the addition cannot be made
867
- * @throws {ArithmeticException} if numeric overflow occurs
868
- */
869
- plusAmount(amount) {
870
- requireNonNull(amount, 'amount');
871
- return amount.addTo(this);
872
- }
873
-
874
854
  /**
875
855
  * Returns a copy of this date with the specified period added.
876
856
  *
@@ -884,7 +864,7 @@ export class LocalDate extends ChronoLocalDate{
884
864
  * @return {LocalDate} a {@link LocalDate} based on this date with the specified period added, not null
885
865
  * @throws {DateTimeException} if the unit cannot be added to this type
886
866
  */
887
- plusAmountUnit(amountToAdd, unit) {
867
+ _plusUnit(amountToAdd, unit) {
888
868
  requireNonNull(amountToAdd, 'amountToAdd');
889
869
  requireNonNull(unit, 'unit');
890
870
  if (unit instanceof ChronoUnit) {
@@ -898,7 +878,7 @@ export class LocalDate extends ChronoLocalDate{
898
878
  case ChronoUnit.MILLENNIA: return this.plusYears(MathUtil.safeMultiply(amountToAdd, 1000));
899
879
  case ChronoUnit.ERAS: return this.with(ChronoField.ERA, MathUtil.safeAdd(this.getLong(ChronoField.ERA), amountToAdd));
900
880
  }
901
- throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
881
+ throw new UnsupportedTemporalTypeException(`Unsupported unit: ${unit}`);
902
882
  }
903
883
  return unit.addTo(this, amountToAdd);
904
884
  }
@@ -995,25 +975,6 @@ export class LocalDate extends ChronoLocalDate{
995
975
  return LocalDate.ofEpochDay(mjDay);
996
976
  }
997
977
 
998
- /**
999
- * Returns a copy of this date with the specified period subtracted.
1000
- *
1001
- * This method returns a new date based on this date with the specified period subtracted.
1002
- * The amount is typically {@link Period} but may be any other type implementing
1003
- * the {@link TemporalAmount} interface.
1004
- * The calculation is delegated to the specified adjuster, which typically calls
1005
- * back to {@link minus}.
1006
- *
1007
- * @param {!TemporalAmount} amount - the amount to subtract, not null
1008
- * @return {LocalDate} a {@link LocalDate} based on this date with the subtraction made, not null
1009
- * @throws {DateTimeException} if the subtraction cannot be made
1010
- * @throws {ArithmeticException} if numeric overflow occurs
1011
- */
1012
- minusAmount(amount) {
1013
- requireNonNull(amount, 'amount');
1014
- return amount.subtractFrom(this);
1015
- }
1016
-
1017
978
  /**
1018
979
  * Returns a copy of this date with the specified period subtracted.
1019
980
  *
@@ -1027,10 +988,10 @@ export class LocalDate extends ChronoLocalDate{
1027
988
  * @return {LocalDate} a {@link LocalDate} based on this date with the specified period subtracted, not null
1028
989
  * @throws {DateTimeException} if the unit cannot be added to this type
1029
990
  */
1030
- minusAmountUnit(amountToSubtract, unit) {
991
+ _minusUnit(amountToSubtract, unit) {
1031
992
  requireNonNull(amountToSubtract, 'amountToSubtract');
1032
993
  requireNonNull(unit, 'unit');
1033
- return this.plusAmountUnit(-1 * amountToSubtract, unit);
994
+ return this._plusUnit(-1 * amountToSubtract, unit);
1034
995
  }
1035
996
 
1036
997
  /**
@@ -1232,7 +1193,7 @@ export class LocalDate extends ChronoLocalDate{
1232
1193
  case ChronoUnit.MILLENNIA: return MathUtil.intDiv(this._monthsUntil(end), 12000);
1233
1194
  case ChronoUnit.ERAS: return end.getLong(ChronoField.ERA) - this.getLong(ChronoField.ERA);
1234
1195
  }
1235
- throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
1196
+ throw new UnsupportedTemporalTypeException(`Unsupported unit: ${unit}`);
1236
1197
  }
1237
1198
  return unit.between(this, end);
1238
1199
  }
@@ -1344,8 +1305,8 @@ export class LocalDate extends ChronoLocalDate{
1344
1305
  } else if (time instanceof OffsetTime) {
1345
1306
  return this._atTimeOffsetTime(time);
1346
1307
  } else {
1347
- throw new IllegalArgumentException('time must be an instance of LocalTime or OffsetTime' +
1348
- (time && time.constructor && time.constructor.name ? ', but is ' + time.constructor.name : ''));
1308
+ throw new IllegalArgumentException(`time must be an instance of LocalTime or OffsetTime${
1309
+ time && time.constructor && time.constructor.name ? `, but is ${time.constructor.name}` : ''}`);
1349
1310
  }
1350
1311
  }
1351
1312
 
@@ -1388,12 +1349,29 @@ export class LocalDate extends ChronoLocalDate{
1388
1349
  * This returns a {@link LocalDateTime} formed from this date at the time of
1389
1350
  * midnight, 00:00, at the start of this date.
1390
1351
  *
1391
- * @param {ZoneId} zone - if zone is not null @see {@link LocalDate.atStartOfDayWithZone}
1352
+ * If zone is not null, this returns a {@link ZonedDateTime} formed from this date at the
1353
+ * specified zone, with the time set to be the earliest valid time according
1354
+ * to the rules in the time-zone.
1355
+ *
1356
+ * Time-zone rules, such as daylight savings, mean that not every local date-time
1357
+ * is valid for the specified zone, thus the local date-time may not be midnight.
1358
+ *
1359
+ * In most cases, there is only one valid offset for a local date-time.
1360
+ * In the case of an overlap, there are two valid offsets, and the earlier one is used,
1361
+ * corresponding to the first occurrence of midnight on the date.
1362
+ * In the case of a gap, the zoned date-time will represent the instant just after the gap.
1363
+ *
1364
+ * If the zone ID is a {@link ZoneOffset}, then the result always has a time of midnight.
1365
+ *
1366
+ * To convert to a specific time in a given time-zone call {@link atTime}
1367
+ * followed by {@link LocalDateTime#atZone}.
1368
+ *
1369
+ * @param {ZoneId} zone - optional ZoneId or ZoneOffset
1392
1370
  * @return {LocalDateTime|ZonedDateTime} the local date-time of midnight at the start of this date, not null
1393
1371
  */
1394
1372
  atStartOfDay(zone) {
1395
1373
  if(zone != null){
1396
- return this.atStartOfDayWithZone(zone);
1374
+ return this._atStartOfDayWithZone(zone);
1397
1375
  } else {
1398
1376
  return LocalDateTime.of(this, LocalTime.MIDNIGHT);
1399
1377
  }
@@ -1423,7 +1401,7 @@ export class LocalDate extends ChronoLocalDate{
1423
1401
  * @param {!ZoneId} zone - the zone ID to use, not null
1424
1402
  * @return {ZonedDateTime} the zoned date-time formed from this date and the earliest valid time for the zone, not null
1425
1403
  */
1426
- atStartOfDayWithZone(zone) {
1404
+ _atStartOfDayWithZone(zone) {
1427
1405
  requireNonNull(zone, 'zone');
1428
1406
  let ldt = this.atTime(LocalTime.MIDNIGHT);
1429
1407
  // need to handle case where there is a gap from 11:30 to 00:30
@@ -1632,28 +1610,28 @@ export class LocalDate extends ChronoLocalDate{
1632
1610
 
1633
1611
  if (absYear < 1000) {
1634
1612
  if (yearValue < 0) {
1635
- yearString = '-' + ('' + (yearValue - 10000)).slice(-4);
1613
+ yearString = `-${(`${yearValue - 10000}`).slice(-4)}`;
1636
1614
  } else {
1637
- yearString = ('' + (yearValue + 10000)).slice(-4);
1615
+ yearString = (`${yearValue + 10000}`).slice(-4);
1638
1616
  }
1639
1617
  } else {
1640
1618
  if (yearValue > 9999) {
1641
- yearString = '+' + yearValue;
1619
+ yearString = `+${yearValue}`;
1642
1620
  } else {
1643
- yearString = '' + yearValue;
1621
+ yearString = `${yearValue}`;
1644
1622
  }
1645
1623
  }
1646
1624
 
1647
1625
  if (monthValue < 10) {
1648
- monthString = '-0' + monthValue;
1626
+ monthString = `-0${monthValue}`;
1649
1627
  } else {
1650
- monthString = '-' + monthValue;
1628
+ monthString = `-${monthValue}`;
1651
1629
  }
1652
1630
 
1653
1631
  if (dayValue < 10) {
1654
- dayString = '-0' + dayValue;
1632
+ dayString = `-0${dayValue}`;
1655
1633
  } else {
1656
- dayString = '-' + dayValue;
1634
+ dayString = `-${dayValue}`;
1657
1635
  }
1658
1636
 
1659
1637
  return yearString + monthString + dayString;
@@ -4,27 +4,27 @@
4
4
  * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
5
5
  */
6
6
 
7
- import {MathUtil} from './MathUtil';
8
- import {assert, requireNonNull, requireInstance} from './assert';
9
- import {DateTimeException, UnsupportedTemporalTypeException, IllegalArgumentException} from './errors';
7
+ import { MathUtil } from './MathUtil';
8
+ import { requireNonNull, requireInstance } from './assert';
9
+ import { DateTimeException, UnsupportedTemporalTypeException } from './errors';
10
10
 
11
- import {Clock} from './Clock';
12
- import {Instant} from './Instant';
13
- import {LocalDate} from './LocalDate';
14
- import {LocalTime} from './LocalTime';
15
- import {OffsetDateTime} from './OffsetDateTime';
16
- import {ZonedDateTime} from './ZonedDateTime';
17
- import {ZoneId} from './ZoneId';
18
- import {ZoneOffset} from './ZoneOffset';
11
+ import { Clock } from './Clock';
12
+ import { Instant } from './Instant';
13
+ import { LocalDate } from './LocalDate';
14
+ import { LocalTime } from './LocalTime';
15
+ import { OffsetDateTime } from './OffsetDateTime';
16
+ import { ZonedDateTime } from './ZonedDateTime';
17
+ import { ZoneId } from './ZoneId';
18
+ import { ZoneOffset } from './ZoneOffset';
19
19
 
20
20
 
21
- import {DateTimeFormatter} from './format/DateTimeFormatter';
22
- import {ChronoField} from './temporal/ChronoField';
23
- import {ChronoUnit} from './temporal/ChronoUnit';
24
- import {TemporalQueries} from './temporal/TemporalQueries';
25
- import {createTemporalQuery} from './temporal/TemporalQuery';
21
+ import { DateTimeFormatter } from './format/DateTimeFormatter';
22
+ import { ChronoField } from './temporal/ChronoField';
23
+ import { ChronoUnit } from './temporal/ChronoUnit';
24
+ import { TemporalQueries } from './temporal/TemporalQueries';
25
+ import { createTemporalQuery } from './temporal/TemporalQuery';
26
26
 
27
- import {ChronoLocalDateTime} from './chrono/ChronoLocalDateTime';
27
+ import { ChronoLocalDateTime } from './chrono/ChronoLocalDateTime';
28
28
 
29
29
  /**
30
30
  * A date-time without a time-zone in the ISO-8601 calendar system,
@@ -637,7 +637,7 @@ implements Temporal, TemporalAdjuster, Serializable */ {
637
637
  * @throws {DateTimeException} if the adjustment cannot be made
638
638
  * @throws {ArithmeticException} if numeric overflow occurs
639
639
  */
640
- withAdjuster(adjuster) {
640
+ _withAdjuster(adjuster) {
641
641
  requireNonNull(adjuster, 'adjuster');
642
642
  // optimizations
643
643
  if (adjuster instanceof LocalDate) {
@@ -647,8 +647,7 @@ implements Temporal, TemporalAdjuster, Serializable */ {
647
647
  } else if (adjuster instanceof LocalDateTime) {
648
648
  return adjuster;
649
649
  }
650
- assert(typeof adjuster.adjustInto === 'function', 'adjuster', IllegalArgumentException);
651
- return adjuster.adjustInto(this);
650
+ return super._withAdjuster(adjuster);
652
651
  }
653
652
 
654
653
  /**
@@ -683,7 +682,7 @@ implements Temporal, TemporalAdjuster, Serializable */ {
683
682
  * @throws {DateTimeException} if the field cannot be set
684
683
  * @throws {ArithmeticException} if numeric overflow occurs
685
684
  */
686
- withFieldValue(field, newValue) {
685
+ _withField(field, newValue) {
687
686
  requireNonNull(field, 'field');
688
687
  if (field instanceof ChronoField) {
689
688
  if (field.isTimeBased()) {
@@ -840,27 +839,6 @@ implements Temporal, TemporalAdjuster, Serializable */ {
840
839
 
841
840
  //-----------------------------------------------------------------------
842
841
 
843
- /**
844
- * Returns a copy of this date-time with the specified period added.
845
- *
846
- * This method returns a new date-time based on this time with the specified period added.
847
- * The amount is typically {@link Period} but may be any other type implementing
848
- * the {@link TemporalAmount} interface.
849
- * The calculation is delegated to the specified adjuster, which typically calls
850
- * back to {@link plus}.
851
- *
852
- * This instance is immutable and unaffected by this method call.
853
- *
854
- * @param {TemporalAmount} amount - the amount to add, not null
855
- * @return {LocalDateTime} based on this date-time with the addition made, not null
856
- * @throws {DateTimeException} if the addition cannot be made
857
- * @throws {ArithmeticException} if numeric overflow occurs
858
- */
859
- plusAmount(amount) {
860
- requireNonNull(amount, 'amount');
861
- return amount.addTo(this);
862
- }
863
-
864
842
  /**
865
843
  * Returns a copy of this date-time with the specified period added.
866
844
  *
@@ -876,7 +854,7 @@ implements Temporal, TemporalAdjuster, Serializable */ {
876
854
  * @return {LocalDateTime} a {@link LocalDateTime} based on this date-time with the specified period added, not null
877
855
  * @throws {DateTimeException} if the unit cannot be added to this type
878
856
  */
879
- plusAmountUnit(amountToAdd, unit) {
857
+ _plusUnit(amountToAdd, unit) {
880
858
  requireNonNull(unit, 'unit');
881
859
  if (unit instanceof ChronoUnit) {
882
860
  switch (unit) {
@@ -1037,27 +1015,6 @@ implements Temporal, TemporalAdjuster, Serializable */ {
1037
1015
 
1038
1016
  //-----------------------------------------------------------------------
1039
1017
 
1040
- /**
1041
- * Returns a copy of this date-time with the specified period subtracted.
1042
- *
1043
- * This method returns a new date-time based on this time with the specified period subtracted.
1044
- * The amount is typically {@link Period} but may be any other type implementing
1045
- * the {@link TemporalAmount} interface.
1046
- * The calculation is delegated to the specified adjuster, which typically calls
1047
- * back to {@link minus}.
1048
- *
1049
- * This instance is immutable and unaffected by this method call.
1050
- *
1051
- * @param {TemporalAmount} amount - the amount to subtract, not null
1052
- * @return {LocalDateTime} based on this date-time with the subtraction made, not null
1053
- * @throws {DateTimeException} if the subtraction cannot be made
1054
- * @throws {ArithmeticException} if numeric overflow occurs
1055
- */
1056
- minusAmount(amount) {
1057
- requireNonNull(amount, 'amount');
1058
- return amount.subtractFrom(this);
1059
- }
1060
-
1061
1018
  /**
1062
1019
  * Returns a copy of this date-time with the specified period subtracted.
1063
1020
  *
@@ -1073,9 +1030,9 @@ implements Temporal, TemporalAdjuster, Serializable */ {
1073
1030
  * @return {LocalDateTime} a {@link LocalDateTime} based on this date-time with the specified period subtracted, not null
1074
1031
  * @throws {DateTimeException} if the unit cannot be added to this type
1075
1032
  */
1076
- minusAmountUnit(amountToSubtract, unit) {
1033
+ _minusUnit(amountToSubtract, unit) {
1077
1034
  requireNonNull(unit, 'unit');
1078
- return this.plusAmountUnit(-1 * amountToSubtract, unit);
1035
+ return this._plusUnit(-1 * amountToSubtract, unit);
1079
1036
  }
1080
1037
 
1081
1038
  //-----------------------------------------------------------------------
@@ -1391,7 +1348,7 @@ implements Temporal, TemporalAdjuster, Serializable */ {
1391
1348
  amount = MathUtil.safeMultiply(amount, 2);
1392
1349
  return MathUtil.safeAdd(amount, MathUtil.intDiv(timeUntil, (LocalTime.NANOS_PER_HOUR * 12)));
1393
1350
  }
1394
- throw new UnsupportedTemporalTypeException('Unsupported unit: ' + unit);
1351
+ throw new UnsupportedTemporalTypeException(`Unsupported unit: ${unit}`);
1395
1352
  }
1396
1353
  let endDate = end._date;
1397
1354
  const endTime = end._time;
@@ -1638,7 +1595,7 @@ implements Temporal, TemporalAdjuster, Serializable */ {
1638
1595
  * @return {string} a string representation of this date-time, not null
1639
1596
  */
1640
1597
  toString() {
1641
- return this._date.toString() + 'T' + this._time.toString();
1598
+ return `${this._date.toString()}T${this._time.toString()}`;
1642
1599
  }
1643
1600
 
1644
1601
  /**