@js-joda/core 1.12.0 → 3.2.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.
@@ -21,120 +21,59 @@ import {TemporalUnit} from './TemporalUnit';
21
21
  * just with slightly different rules.
22
22
  * The documentation of each unit explains how it operates.
23
23
  *
24
- * ### Static properties of Class {@link ChronoUnit}
25
- *
26
- * ChronoUnit.NANOS
27
- *
28
- * Unit that represents the concept of a nanosecond, the smallest supported unit of time.
29
- * For the ISO calendar system, it is equal to the 1,000,000,000th part of the second unit.
30
- *
31
- * ChronoUnit.MICROS
32
- *
33
- * Unit that represents the concept of a microsecond.
34
- * For the ISO calendar system, it is equal to the 1,000,000th part of the second unit.
35
- *
36
- * ChronoUnit.MILLIS
37
- *
38
- * Unit that represents the concept of a millisecond.
39
- * For the ISO calendar system, it is equal to the 1000th part of the second unit.
40
- *
41
- * ChronoUnit.SECONDS
42
- *
43
- * Unit that represents the concept of a second.
44
- * For the ISO calendar system, it is equal to the second in the SI system
45
- * of units, except around a leap-second.
46
- *
47
- * ChronoUnit.MINUTES
48
- *
49
- * Unit that represents the concept of a minute.
50
- * For the ISO calendar system, it is equal to 60 seconds.
51
- *
52
- * ChronoUnit.HOURS
53
- *
54
- * Unit that represents the concept of an hour.
55
- * For the ISO calendar system, it is equal to 60 minutes.
56
- *
57
- * ChronoUnit.HALF_DAYS
58
- *
59
- * Unit that represents the concept of half a day, as used in AM/PM.
60
- * For the ISO calendar system, it is equal to 12 hours.
61
- *
62
- * ChronoUnit.DAYS
63
- *
64
- * Unit that represents the concept of a day.
65
- * For the ISO calendar system, it is the standard day from midnight to midnight.
66
- * The estimated duration of a day is 24 hours.
67
- *
68
- * When used with other calendar systems it must correspond to the day defined by
69
- * the rising and setting of the Sun on Earth. It is not required that days begin
70
- * at midnight - when converting between calendar systems, the date should be
71
- * equivalent at midday.
72
- *
73
- * ChronoUnit.WEEKS
74
- *
75
- * Unit that represents the concept of a week.
76
- * For the ISO calendar system, it is equal to 7 days.
77
- *
78
- * When used with other calendar systems it must correspond to an integral number of days.
79
- *
80
- * ChronoUnit.MONTHS
81
- *
82
- * Unit that represents the concept of a month.
83
- * For the ISO calendar system, the length of the month varies by month-of-year.
84
- * The estimated duration of a month is one twelfth of 365.2425 days.
85
- *
86
- * When used with other calendar systems it must correspond to an integral number of days.
87
- *
88
- * ChronoUnit.YEARS
89
- *
90
- * Unit that represents the concept of a year.
91
- * For the ISO calendar system, it is equal to 12 months.
92
- * The estimated duration of a year is 365.2425 days.
93
- *
94
- * When used with other calendar systems it must correspond to an integral number of days
95
- * or months roughly equal to a year defined by the passage of the Earth around the Sun.
96
- *
97
- * ChronoUnit.DECADES
98
- *
99
- * Unit that represents the concept of a decade.
100
- * For the ISO calendar system, it is equal to 10 years.
101
- *
102
- * When used with other calendar systems it must correspond to an integral number of days
103
- * and is normally an integral number of years.
104
- *
105
- * ChronoUnit.CENTURIES
106
- *
107
- * Unit that represents the concept of a century.
108
- * For the ISO calendar system, it is equal to 100 years.
109
- *
110
- * When used with other calendar systems it must correspond to an integral number of days
111
- * and is normally an integral number of years.
112
- *
113
- * ChronoUnit.MILLENNIA
114
- *
115
- * Unit that represents the concept of a millennium.
116
- * For the ISO calendar system, it is equal to 1000 years.
117
- *
118
- * When used with other calendar systems it must correspond to an integral number of days
119
- * and is normally an integral number of years.
120
- *
121
- * ChronoUnit.ERAS
122
- *
123
- * Unit that represents the concept of an era.
124
- * The ISO calendar system doesn't have eras thus it is impossible to add
125
- * an era to a date or date-time.
126
- * The estimated duration of the era is artificially defined as {Year.MAX_VALUE} + 1.
127
- *
128
- * When used with other calendar systems there are no restrictions on the unit.
129
- *
130
- * ChronoUnit.FOREVER
131
- *
132
- * Artificial unit that represents the concept of forever.
133
- * This is primarily used with {@link TemporalField} to represent unbounded fields
134
- * such as the year or era.
135
- * The estimated duration of the era is artificially defined as the largest duration
136
- * supported by {@link Duration}.
137
- *
24
+ * ### Static properties:
25
+ *
26
+ * - `ChronoUnit.CENTURIES`: Unit that represents the concept of a century. For the ISO calendar
27
+ * system, it is equal to 100 years.
28
+ *
29
+ * - `ChronoUnit.DAYS`: Unit that represents the concept of a day. For the ISO calendar system, it
30
+ * is the standard day from midnight to midnight. The estimated duration of a day is 24 Hours.
31
+ *
32
+ * - `ChronoUnit.DECADES`: Unit that represents the concept of a decade. For the ISO calendar system,
33
+ * it is equal to 10 years.
34
+ *
35
+ * - `ChronoUnit.ERAS`: Unit that represents the concept of an era. The ISO calendar system doesn't
36
+ * have eras thus it is impossible to add an era to a date or date-time. The estimated duration of the
37
+ * era is artificially defined as 1,000,000,000 Years.
38
+ *
39
+ * - `ChronoUnit.FOREVER`: Artificial unit that represents the concept of forever. This is primarily
40
+ * used with {@link TemporalField} to represent unbounded fields such as the year or era. The
41
+ * estimated duration of the era is artificially defined as the largest duration supported by
42
+ * {@link Duration}.
43
+ *
44
+ * - `ChronoUnit.HALF_DAYS`: Unit that represents the concept of half a day, as used in AM/PM. For
45
+ * the ISO calendar system, it is equal to 12 hours.
46
+ *
47
+ * - `ChronoUnit.HOURS`: Unit that represents the concept of an hour. For the ISO calendar system,
48
+ * it is equal to 60 minutes.
49
+ *
50
+ * - `ChronoUnit.MICROS`: Unit that represents the concept of a microsecond. For the ISO calendar
51
+ * system, it is equal to the 1,000,000th part of the second unit.
52
+ *
53
+ * - `ChronoUnit.MILLENNIA`: Unit that represents the concept of a millennium. For the ISO calendar
54
+ * system, it is equal to 1,000 years.
55
+ *
56
+ * - `ChronoUnit.MILLIS`: Unit that represents the concept of a millisecond. For the ISO calendar
57
+ * system, it is equal to the 1000th part of the second unit.
58
+ *
59
+ * - `ChronoUnit.MINUTES`: Unit that represents the concept of a minute. For the ISO calendar system,
60
+ * it is equal to 60 seconds.
61
+ *
62
+ * - `ChronoUnit.MONTHS`: Unit that represents the concept of a month. For the ISO calendar system,
63
+ * the length of the month varies by month-of-year. The estimated duration of a month is one twelfth
64
+ * of 365.2425 Days.
65
+ *
66
+ * - `ChronoUnit.NANOS`: Unit that represents the concept of a nanosecond, the smallest supported unit
67
+ * of time. For the ISO calendar system, it is equal to the 1,000,000,000th part of the second unit.
68
+ *
69
+ * - `ChronoUnit.SECONDS`: Unit that represents the concept of a second. For the ISO calendar system,
70
+ * it is equal to the second in the SI system of units, except around a leap-second.
71
+ *
72
+ * - `ChronoUnit.WEEKS`: Unit that represents the concept of a week. For the ISO calendar system,
73
+ * it is equal to 7 Days.
74
+ *
75
+ * - `ChronoUnit.YEARS`: Unit that represents the concept of a year. For the ISO calendar system, it
76
+ * is equal to 12 months. The estimated duration of a year is 365.2425 Days.
138
77
  */
139
78
  export class ChronoUnit extends TemporalUnit {
140
79
 
@@ -152,27 +91,14 @@ export class ChronoUnit extends TemporalUnit {
152
91
 
153
92
  //-----------------------------------------------------------------------
154
93
  /**
155
- * Gets the estimated duration of this unit in the ISO calendar system.
156
- *
157
- * All of the units in this class have an estimated duration.
158
- * Days vary due to daylight saving time, while months have different lengths.
159
- *
160
- * @return {Duration} the estimated duration of this unit, not null
94
+ * @return {Duration} the duration of this unit, which may be an estimate.
161
95
  */
162
96
  duration() {
163
97
  return this._duration;
164
98
  }
165
99
 
166
100
  /**
167
- * Checks if the duration of the unit is an estimate.
168
- *
169
- * All time units in this class are considered to be accurate, while all date
170
- * units in this class are considered to be estimated.
171
- *
172
- * This definition ignores leap seconds, but considers that Days vary due to
173
- * daylight saving time and months have different lengths.
174
- *
175
- * @return {boolean} true if the duration is estimated, false if accurate
101
+ * @return {boolean} `true` if the duration is estimated, `false` if accurate.
176
102
  */
177
103
  isDurationEstimated() {
178
104
  return this.isDateBased() || this === ChronoUnit.FOREVER;
@@ -180,9 +106,7 @@ export class ChronoUnit extends TemporalUnit {
180
106
 
181
107
  //-----------------------------------------------------------------------
182
108
  /**
183
- * Checks if this unit is a date unit.
184
- *
185
- * @return true if a date unit, false if a time unit
109
+ * @return {boolean} `true` if date unit, `false` if a time unit.
186
110
  */
187
111
  isDateBased() {
188
112
  return this.compareTo(ChronoUnit.DAYS) >= 0 && this !== ChronoUnit.FOREVER;
@@ -191,7 +115,7 @@ export class ChronoUnit extends TemporalUnit {
191
115
  /**
192
116
  * Checks if this unit is a time unit.
193
117
  *
194
- * @return true if a time unit, false if a date unit
118
+ * @return {boolean} `true` if time unit, `false` if a date unit.
195
119
  */
196
120
  isTimeBased() {
197
121
  return this.compareTo(ChronoUnit.DAYS) < 0;
@@ -199,16 +123,8 @@ export class ChronoUnit extends TemporalUnit {
199
123
 
200
124
  //-----------------------------------------------------------------------
201
125
  /**
202
- * Checks if this unit is supported by the specified temporal object.
203
- *
204
- * This checks that the implementing date-time can add/subtract this unit.
205
- * This can be used to avoid throwing an exception.
206
- *
207
- * This default implementation derives the value using
208
- * {@link Temporal#plus}.
209
- *
210
- * @param {Temporal} temporal the temporal object to check, not null
211
- * @return {boolean} true if the unit is supported
126
+ * @param {!Temporal} temporal the temporal object to check.
127
+ * @return {boolean} `true` if the unit is supported.
212
128
  */
213
129
  isSupportedBy(temporal) {
214
130
  if (this === ChronoUnit.FOREVER) {
@@ -237,37 +153,10 @@ export class ChronoUnit extends TemporalUnit {
237
153
  }
238
154
 
239
155
  /**
240
- * Returns a copy of the specified temporal object with the specified period added.
241
- *
242
- * The period added is a multiple of this unit. For example, this method
243
- * could be used to add "3 days" to a date by calling this method on the
244
- * instance representing "days", passing the date and the period "3".
245
- * The period to be added may be negative, which is equivalent to subtraction.
246
- *
247
- * There are two equivalent ways of using this method.
248
- * The first is to invoke this method directly.
249
- * The second is to use {@link Temporal#plus}:
250
- * <pre>
251
- * // these two lines are equivalent, but the second approach is recommended
252
- * temporal = thisUnit.addTo(temporal);
253
- * temporal = temporal.plus(thisUnit);
254
- * </pre>
255
- * It is recommended to use the second approach, {@link plus},
256
- * as it is a lot clearer to read in code.
257
- *
258
- * Implementations should perform any queries or calculations using the units
259
- * available in {@link ChronoUnit} or the fields available in {@link ChronoField}.
260
- * If the unit is not supported an {@link UnsupportedTemporalTypeException} must be thrown.
261
- *
262
- * Implementations must not alter the specified temporal object.
263
- * Instead, an adjusted copy of the original must be returned.
264
- * This provides equivalent, safe behavior for immutable and mutable implementations.
265
- *
266
- * @param {Temporal} temporal the temporal object to adjust, not null
267
- * @param {Number} amount the amount of this unit to add, positive or negative
268
- * @return {Temporal} the adjusted temporal object, not null
269
- * @throws DateTimeException if the amount cannot be added
270
- * @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal
156
+ * @param {!Temporal} dateTime the temporal object to adjust.
157
+ * @param {number} periodToAdd the period of this unit to add, positive or negative.
158
+ * @return {Temporal} the adjusted temporal object.
159
+ * @throws DateTimeException if the period cannot be added.
271
160
  */
272
161
  addTo(temporal, amount) {
273
162
  return temporal.plus(amount, this);
@@ -275,58 +164,12 @@ export class ChronoUnit extends TemporalUnit {
275
164
 
276
165
  //-----------------------------------------------------------------------
277
166
  /**
278
- * Calculates the amount of time between two temporal objects.
279
- *
280
- * This calculates the amount in terms of this unit. The start and end
281
- * points are supplied as temporal objects and must be of compatible types.
282
- * The implementation will convert the second type to be an instance of the
283
- * first type before the calculating the amount.
284
- * The result will be negative if the end is before the start.
285
- * For example, the amount in hours between two temporal objects can be
286
- * calculated using {@link HOURS.between}.
287
- *
288
- * The calculation returns a whole number, representing the number of
289
- * complete units between the two temporals.
290
- * For example, the amount in hours between the times 11:30 and 13:29
291
- * will only be one hour as it is one minute short of two hours.
292
- *
293
- * There are two equivalent ways of using this method.
294
- * The first is to invoke this method directly.
295
- * The second is to use {@link Temporal#until}:
296
- * <pre>
297
- * // these two lines are equivalent
298
- * between = thisUnit.between(start, end);
299
- * between = start.until(end, thisUnit);
300
- * </pre>
301
- * The choice should be made based on which makes the code more readable.
302
- *
303
- * For example, this method allows the number of days between two dates to
304
- * be calculated:
305
- * <pre>
306
- * daysBetween = DAYS.between(start, end);
307
- * // or alternatively
308
- * daysBetween = start.until(end, DAYS);
309
- * </pre>
310
- *
311
- * Implementations should perform any queries or calculations using the units
312
- * available in {@link ChronoUnit} or the fields available in {@link ChronoField}.
313
- * If the unit is not supported an {@link UnsupportedTemporalTypeException} must be thrown.
314
- * Implementations must not alter the specified temporal objects.
315
- *
316
- * @implSpec
317
- * Implementations must begin by checking to if the two temporals have the
318
- * same type using `.constructor.name`. If they do not, then the result must be
319
- * obtained by calling `temporal1.until`.
320
- *
321
- * @param {Temporal} temporal1 the base temporal object, not null
322
- * @param {Temporal} temporal2 the other temporal object, exclusive, not null
323
- * @return {Number} the amount of time between temporal1 and temporal2
324
- * in terms of this unit; positive if temporal2 is later than
325
- * temporal1, negative if earlier
326
- * @throws DateTimeException if the amount cannot be calculated, or the end
327
- * temporal cannot be converted to the same type as the start temporal
328
- * @throws UnsupportedTemporalTypeException if the unit is not supported by the temporal
329
- * @throws ArithmeticException if numeric overflow occurs
167
+ * @param {!Temporal} temporal1 the base temporal object.
168
+ * @param {!Temporal} temporal2 the other temporal object.
169
+ * @return {number} the period between temporal1 and temporal2 in terms of this unit;
170
+ * positive if temporal2 is later than temporal1, negative if earlier.
171
+ * @throws DateTimeException if the period cannot be calculated.
172
+ * @throws ArithmeticException if numeric overflow occurs.
330
173
  */
331
174
  between(temporal1, temporal2) {
332
175
  return temporal1.until(temporal2, this);
@@ -338,12 +181,12 @@ export class ChronoUnit extends TemporalUnit {
338
181
  }
339
182
 
340
183
  /**
341
- * Compares this ChronoUnit to the specified {TemporalUnit}.
184
+ * Compares this ChronoUnit to the specified {@link TemporalUnit}.
342
185
  *
343
186
  * The comparison is based on the total length of the durations.
344
187
  *
345
- * @param {TemporalUnit} other the other unit to compare to, not null
346
- * @return the comparator value, negative if less, positive if greater
188
+ * @param {!TemporalUnit} other the other unit to compare to.
189
+ * @return the comparator value, negative if less, positive if greater.
347
190
  */
348
191
  compareTo(other) {
349
192
  return this.duration().compareTo(other.duration());
@@ -0,0 +1,118 @@
1
+ import {MAX_SAFE_INTEGER, MIN_SAFE_INTEGER} from '../MathUtil';
2
+ import {requireInstance, requireNonNull} from '../assert';
3
+ import {TemporalAdjuster} from './TemporalAdjuster';
4
+ import {TemporalAmount} from './TemporalAmount';
5
+ import {TemporalUnit} from './TemporalUnit';
6
+ import {Temporal} from './Temporal';
7
+
8
+ export class DefaultInterfaceTemporal extends Temporal {
9
+ /**
10
+ * Returns an adjusted object of the same type as this object with the adjustment made.
11
+ * This adjusts this date-time according to the rules of the specified adjuster. A simple adjuster might simply set the one of the fields, such as the year field. A more complex adjuster might set the date to the last day of the month. A selection of common adjustments is provided in {@link TemporalAdjusters}. These include finding the "last day of the month" and "next Wednesday". The adjuster is responsible for handling special cases, such as the varying lengths of month and leap years.
12
+ *
13
+ * Some example code indicating how and why this method is used:
14
+ *
15
+ * <pre>
16
+ * date = date.with(Month.JULY); // most key classes implement TemporalAdjuster
17
+ * date = date.with(lastDayOfMonth()); // static import from TemporalAdjusters
18
+ * date = date.with(next(WEDNESDAY)); // static import from TemporalAdjusters and DayOfWeek
19
+ * </pre>
20
+ *
21
+ * ### Specification for implementors
22
+ * Implementations must not alter either this object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
23
+ *
24
+ * @param {TemporalAdjuster} adjuster - the adjuster to use, not null
25
+ * @return {Temporal} an object of the same type with the specified adjustment made, not null
26
+ * @throws DateTimeException - if unable to make the adjustment
27
+ * @throws ArithmeticException - if numeric overflow occurs
28
+ */
29
+ withAdjuster(adjuster) {
30
+ requireNonNull(adjuster, 'adjuster');
31
+ requireInstance(adjuster, TemporalAdjuster, 'adjuster');
32
+ return adjuster.adjustInto(this);
33
+ }
34
+
35
+ /**
36
+ * Returns an object of the same type as this object with an amount added.
37
+ * This adjusts this temporal, adding according to the rules of the specified amount. The amount is typically a {@link Period} but may be any other type implementing the {@link TemporalAmount} interface, such as {@link Duration}.
38
+ *
39
+ * Some example code indicating how and why this method is used:
40
+ *
41
+ * <pre>
42
+ * date = date.plus(period); // add a Period instance
43
+ * date = date.plus(duration); // add a Duration instance
44
+ * date = date.plus(workingDays(6)); // example user-written workingDays method
45
+ * </pre>
46
+ *
47
+ * Note that calling plus followed by minus is not guaranteed to return the same date-time.
48
+ *
49
+ * ### Specification for implementors
50
+ * Implementations must not alter either this object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
51
+ *
52
+ * @param {TemporalAmount} amount - the amount to add, not null
53
+ * @return {Temporal} an object of the same type with the specified adjustment made, not null
54
+ * @throws DateTimeException - if the addition cannot be made
55
+ * @throws ArithmeticException - if numeric overflow occurs
56
+ */
57
+ plusAmount(amount) {
58
+ requireNonNull(amount, 'amount');
59
+ requireInstance(amount, TemporalAmount, 'amount');
60
+ return amount.addTo(this);
61
+ }
62
+
63
+ /**
64
+ * Returns an object of the same type as this object with an amount subtracted.
65
+ * This adjusts this temporal, subtracting according to the rules of the specified amount. The
66
+ * amount is typically a {@link Period} but may be any other type implementing the {@link TemporalAmount} interface, such as Duration.
67
+ *
68
+ * Some example code indicating how and why this method is used:
69
+ *
70
+ * <pre>
71
+ * date = date.minus(period); // subtract a Period instance
72
+ * date = date.minus(duration); // subtract a Duration instance
73
+ * date = date.minus(workingDays(6)); // example user-written workingDays method
74
+ * </pre>
75
+ *
76
+ * Note that calling plus followed by minus is not guaranteed to return the same date-time.
77
+ *
78
+ * ### Specification for implementors
79
+ * Implementations must not alter either this object. Instead, an adjusted copy of the original
80
+ * must be returned. This provides equivalent, safe behavior for immutable and mutable
81
+ * implementations.
82
+ *
83
+ * @param {TemporalAmount} amount - the amount to subtract, not null
84
+ * @return {Temporal} an object of the same type with the specified adjustment made, not null
85
+ * @throws DateTimeException - if the subtraction cannot be made
86
+ * @throws ArithmeticException - if numeric overflow occurs
87
+ */
88
+ minusAmount(amount) {
89
+ requireNonNull(amount, 'amount');
90
+ requireInstance(amount, TemporalAmount, 'amount');
91
+ return amount.subtractFrom(this);
92
+ }
93
+
94
+ /**
95
+ * Returns an object of the same type as this object with the specified period subtracted.
96
+ * This method returns a new object based on this one with the specified period subtracted. For example, on a {@link LocalDate}, this could be used to subtract a number of years, months or days. The returned object will have the same observable type as this object.
97
+ *
98
+ * In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st March, then subtracting one month would be unclear. In cases like this, the field is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.
99
+ *
100
+ * If the implementation represents a date-time that has boundaries, such {@link as} LocalTime, then the permitted units must include the boundary unit, but no multiples of the boundary unit. For example, {@link LocalTime} must accept `DAYS` but not `WEEKS` or `MONTHS`.
101
+ *
102
+ * ### Specification for implementors
103
+ * Implementations must behave in a manor equivalent to the default method behavior.
104
+ * Implementations must not alter either this object or the specified temporal object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
105
+ *
106
+ * @param {number} amountToSubtract - the amount of the specified unit to subtract, may be negative
107
+ * @param {TemporalUnit} unit - the unit of the period to subtract, not null
108
+ * @return {Temporal} an object of the same type with the specified period subtracted, not null
109
+ * @throws DateTimeException - if the unit cannot be subtracted
110
+ * @throws ArithmeticException - if numeric overflow occurs
111
+ */
112
+ minusAmountUnit(amountToSubtract, unit) {
113
+ requireNonNull(amountToSubtract, 'amountToSubtract');
114
+ requireNonNull(unit, 'unit');
115
+ requireInstance(unit, TemporalUnit, 'unit');
116
+ return (amountToSubtract === MIN_SAFE_INTEGER ? this.plusAmountUnit(MAX_SAFE_INTEGER, unit).plusAmountUnit(1, unit) : this.plusAmount(-amountToSubtract, unit));
117
+ }
118
+ }
@@ -39,9 +39,9 @@ import {ResolverStyle} from '../format/ResolverStyle';
39
39
  *
40
40
  * The complete date is expressed using three fields:
41
41
  *
42
- * * {@link DAY_OF_QUARTER} - the day within the quarter, from 1 to 90, 91 or 92
43
- * * {@link QUARTER_OF_YEAR} - the week within the week-based-year
44
- * * {@link ChronoField#YEAR} - the standard ISO year
42
+ * * `IsoFields.DAY_OF_QUARTER` - the day within the quarter, from 1 to 90, 91 or 92
43
+ * * `QUARTER_OF_YEAR` - the week within the week-based-year
44
+ * * `ChronoField.YEAR` - the standard ISO year (see {@link ChronoField})
45
45
  *
46
46
  * ### Week based years
47
47
  *
@@ -51,10 +51,10 @@ import {ResolverStyle} from '../format/ResolverStyle';
51
51
  *
52
52
  * The date is expressed using three fields:
53
53
  *
54
- * * {@link ChronoField#DAY_OF_WEEK} - the standard field defining the
55
- * day-of-week from Monday (1) to Sunday (7)
56
- * * {@link WEEK_OF_WEEK_BASED_YEAR} - the week within the week-based-year
57
- * * {@link WEEK_BASED_YEAR} - the week-based-year
54
+ * * `ChronoField.DAY_OF_WEEK` - the standard field defining the
55
+ * day-of-week from Monday (1) to Sunday (7) (see {@link ChronoField})
56
+ * * `WEEK_OF_WEEK_BASED_YEAR` - the week within the week-based-year
57
+ * * `WEEK_BASED_YEAR` - the week-based-year
58
58
  *
59
59
  * The week-based-year itself is defined relative to the standard ISO proleptic year.
60
60
  * It differs from the standard year in that it always starts on a Monday.
@@ -81,11 +81,7 @@ import {ResolverStyle} from '../format/ResolverStyle';
81
81
  * * Sunday, 2009-01-04: Week 1 of week-based-year 2009
82
82
  * * Monday, 2009-01-05: Week 2 of week-based-year 2009
83
83
  *
84
- * ### Static properties of Class {@link IsoFields}
85
- *
86
- * IsoFields.DAY_OF_QUARTER
87
- *
88
- * The field that represents the day-of-quarter.
84
+ * @property {TemporalField} DAY_OF_QUARTER The field that represents the day-of-quarter.
89
85
  *
90
86
  * This field allows the day-of-quarter value to be queried and set.
91
87
  * The day-of-quarter has values from 1 to 90 in Q1 of a standard year, from 1 to 91
@@ -98,30 +94,24 @@ import {ResolverStyle} from '../format/ResolverStyle';
98
94
  * value from 1 to 92. If the quarter has less than 92 days, then day 92, and
99
95
  * potentially day 91, is in the following quarter.
100
96
  *
101
- * IsoFields.QUARTER_OF_YEAR
102
- *
103
- * The field that represents the quarter-of-year.
97
+ * @property {TemporalField} QUARTER_OF_YEAR The field that represents the quarter-of-year.
104
98
  *
105
99
  * This field allows the quarter-of-year value to be queried and set.
106
100
  * The quarter-of-year has values from 1 to 4.
107
101
  *
108
102
  * The day-of-quarter can only be calculated if the month-of-year is available.
109
103
  *
110
- * IsoFields.WEEK_OF_WEEK_BASED_YEAR
111
- *
112
- * The field that represents the week-of-week-based-year.
104
+ * @property {TemporalField} WEEK_OF_WEEK_BASED_YEAR The field that represents the
105
+ * week-of-week-based-year.
113
106
  *
114
107
  * This field allows the week of the week-based-year value to be queried and set.
115
108
  *
116
- * IsoFields.WEEK_BASED_YEAR
117
- *
118
- * The field that represents the week-based-year.
109
+ * @property {TemporalField} WEEK_BASED_YEAR The field that represents the week-based-year.
119
110
  *
120
111
  * This field allows the week-based-year value to be queried and set.
121
112
  *
122
- * IsoFields.WEEK_BASED_YEARS
123
- *
124
- * The unit that represents week-based-years for the purpose of addition and subtraction.
113
+ * @property {TemporalField} WEEK_BASED_YEARS The unit that represents week-based-years for
114
+ * the purpose of addition and subtraction.
125
115
  *
126
116
  * This allows a number of week-based-years to be added to, or subtracted from, a date.
127
117
  * The unit is equal to either 52 or 53 weeks.
@@ -132,14 +122,14 @@ import {ResolverStyle} from '../format/ResolverStyle';
132
122
  * for the week-based-year field. If the resulting week-based-year only has 52 weeks,
133
123
  * then the date will be in week 1 of the following week-based-year.
134
124
  *
135
- * IsoFields.QUARTER_YEARS
136
- *
137
- * Unit that represents the concept of a quarter-year.
125
+ * @property {TemporalField} QUARTER_YEARS Unit that represents the concept of a quarter-year.
138
126
  * For the ISO calendar system, it is equal to 3 months.
139
127
  * The estimated duration of a quarter-year is one quarter of 365.2425 days.
128
+ *
129
+ * @typedef {Object} IsoFields
130
+ * @type {Object}
140
131
  */
141
- export class IsoFields {
142
- }
132
+ export const IsoFields = {};
143
133
 
144
134
  //-----------------------------------------------------------------------
145
135
 
@@ -147,6 +137,7 @@ const QUARTER_DAYS = [0, 90, 181, 273, 0, 91, 182, 274];
147
137
 
148
138
  /**
149
139
  * Implementation of the field.
140
+ * @private
150
141
  */
151
142
  class Field extends TemporalField{
152
143
 
@@ -252,7 +243,7 @@ class Field extends TemporalField{
252
243
  *
253
244
  * @returns {string}
254
245
  */
255
- getDisplayName(/*locale*/) {
246
+ displayName(/*locale*/) {
256
247
  return this.toString();
257
248
  }
258
249
 
@@ -270,7 +261,9 @@ class Field extends TemporalField{
270
261
 
271
262
  }
272
263
 
273
-
264
+ /**
265
+ * @private
266
+ */
274
267
  class DAY_OF_QUARTER_FIELD extends Field {
275
268
 
276
269
  /**
@@ -407,6 +400,9 @@ class DAY_OF_QUARTER_FIELD extends Field {
407
400
  }
408
401
  }
409
402
 
403
+ /**
404
+ * @private
405
+ */
410
406
  class QUARTER_OF_YEAR_FIELD extends Field {
411
407
 
412
408
  /**
@@ -488,6 +484,9 @@ class QUARTER_OF_YEAR_FIELD extends Field {
488
484
 
489
485
  }
490
486
 
487
+ /**
488
+ * @private
489
+ */
491
490
  class WEEK_OF_WEEK_BASED_YEAR_FIELD extends Field {
492
491
 
493
492
  /**
@@ -615,12 +614,15 @@ class WEEK_OF_WEEK_BASED_YEAR_FIELD extends Field {
615
614
  *
616
615
  * @returns {string}
617
616
  */
618
- getDisplayName() {
617
+ displayName() {
619
618
  return 'Week';
620
619
  }
621
620
 
622
621
  }
623
622
 
623
+ /**
624
+ * @private
625
+ */
624
626
  class WEEK_BASED_YEAR_FIELD extends Field {
625
627
 
626
628
  /**
@@ -715,6 +717,7 @@ class WEEK_BASED_YEAR_FIELD extends Field {
715
717
  //-----------------------------------------------------------------------
716
718
  /**
717
719
  * Implementation of the period unit.
720
+ * @private
718
721
  */
719
722
  class Unit extends TemporalUnit {
720
723