@js-joda/extra 0.9.1 → 0.10.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/dist/js-joda-extra.esm.js +1991 -22
- package/dist/js-joda-extra.esm.js.map +1 -1
- package/dist/js-joda-extra.js +1994 -20
- package/dist/js-joda-extra.js.map +1 -1
- package/dist/js-joda-extra.min.js +2 -2
- package/package.json +3 -3
- package/src/DayOfMonth.js +54 -54
- package/src/DayOfYear.js +48 -49
- package/src/Interval.js +93 -99
- package/src/LocalDateRange.js +750 -0
- package/src/OffsetDate.js +1279 -0
- package/src/Quarter.js +587 -0
- package/src/YearQuarter.js +1177 -0
- package/src/YearWeek.js +1026 -0
- package/src/_init.js +10 -0
- package/src/assert.js +2 -2
- package/src/js-joda-extra.js +10 -0
- package/src/plug.js +10 -0
- package/typings/js-joda-extra.d.ts +234 -2
package/src/Interval.js
CHANGED
|
@@ -11,14 +11,14 @@ import { requireNonNull, requireInstance } from './assert';
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* An immutable interval of time between two instants.
|
|
14
|
-
*
|
|
14
|
+
*
|
|
15
15
|
* An interval represents the time on the time-line between two {@link Instant}s.
|
|
16
16
|
* The class stores the start and end instants, with the start inclusive and the end exclusive.
|
|
17
17
|
* The end instant is always greater than or equal to the start instant.
|
|
18
|
-
*
|
|
18
|
+
*
|
|
19
19
|
* The {@link Duration} of an interval can be obtained, but is a separate concept.
|
|
20
20
|
* An interval is connected to the time-line, whereas a duration is not.
|
|
21
|
-
*
|
|
21
|
+
*
|
|
22
22
|
* Intervals are not comparable. To compare the length of two intervals, it is
|
|
23
23
|
* generally recommended to compare their durations.
|
|
24
24
|
*
|
|
@@ -27,16 +27,13 @@ export class Interval {
|
|
|
27
27
|
//-----------------------------------------------------------------------
|
|
28
28
|
/**
|
|
29
29
|
* function overloading for {@link Interval.of}
|
|
30
|
+
* - If called without arguments, then {@link Interval.ofInstantInstant} is executed.
|
|
31
|
+
* - If called with 1 arguments and first argument is an instance of ZoneId, then {@link Interval.ofInstantDuration} is executed.
|
|
32
|
+
* - Otherwise {@link Interval.ofInstantDuration} is executed.
|
|
30
33
|
*
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* Otherwise {@link Interval.ofInstantDuration} is executed.
|
|
36
|
-
*
|
|
37
|
-
* @param {!(Instant)} startInstant
|
|
38
|
-
* @param {!(Instant|Duration)} endInstantOrDuration
|
|
39
|
-
* @returns {Interval}
|
|
34
|
+
* @param {Instant} startInstant
|
|
35
|
+
* @param {Instant|Duration} endInstantOrDuration
|
|
36
|
+
* @return {Interval}
|
|
40
37
|
*/
|
|
41
38
|
static of(startInstant, endInstantOrDuration) {
|
|
42
39
|
if (endInstantOrDuration instanceof Duration) {
|
|
@@ -47,14 +44,15 @@ export class Interval {
|
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
/**
|
|
50
|
-
* Obtains an instance of
|
|
51
|
-
*
|
|
47
|
+
* Obtains an instance of `Interval` from the start and end instant.
|
|
48
|
+
*
|
|
52
49
|
* The end instant must not be before the start instant.
|
|
53
50
|
*
|
|
54
|
-
* @param {Instant} startInclusive
|
|
55
|
-
* @param {Instant} endExclusive
|
|
51
|
+
* @param {Instant} startInclusive - the start instant, inclusive, MIN_DATE treated as unbounded, not null
|
|
52
|
+
* @param {Instant} endExclusive - the end instant, exclusive, MAX_DATE treated as unbounded, not null
|
|
56
53
|
* @return {Interval} the half-open interval, not null
|
|
57
|
-
* @throws DateTimeException if the end is before the start
|
|
54
|
+
* @throws {DateTimeException} if the end is before the start
|
|
55
|
+
* @protected
|
|
58
56
|
*/
|
|
59
57
|
static ofInstantInstant(startInclusive, endExclusive) {
|
|
60
58
|
requireNonNull(startInclusive, 'startInclusive');
|
|
@@ -68,17 +66,18 @@ export class Interval {
|
|
|
68
66
|
}
|
|
69
67
|
|
|
70
68
|
/**
|
|
71
|
-
* Obtains an instance of
|
|
72
|
-
*
|
|
69
|
+
* Obtains an instance of `Interval` from the start and a duration.
|
|
70
|
+
*
|
|
73
71
|
* The end instant is calculated as the start plus the duration.
|
|
74
72
|
* The duration must not be negative.
|
|
75
73
|
*
|
|
76
|
-
* @param {Instant} startInclusive
|
|
77
|
-
* @param {Duration} duration
|
|
74
|
+
* @param {Instant} startInclusive - the start instant, inclusive, not null
|
|
75
|
+
* @param {Duration} duration - the duration from the start to the end, not null
|
|
78
76
|
* @return {Interval} the interval, not null
|
|
79
|
-
* @throws DateTimeException if the end is before the start,
|
|
77
|
+
* @throws {DateTimeException} if the end is before the start,
|
|
80
78
|
* or if the duration addition cannot be made
|
|
81
|
-
* @throws ArithmeticException if numeric overflow occurs when adding the duration
|
|
79
|
+
* @throws {ArithmeticException} if numeric overflow occurs when adding the duration
|
|
80
|
+
* @protected
|
|
82
81
|
*/
|
|
83
82
|
static ofInstantDuration(startInclusive, duration) {
|
|
84
83
|
requireNonNull(startInclusive, 'startInclusive');
|
|
@@ -94,25 +93,23 @@ export class Interval {
|
|
|
94
93
|
//-----------------------------------------------------------------------
|
|
95
94
|
|
|
96
95
|
/**
|
|
97
|
-
* Obtains an instance of
|
|
98
|
-
*
|
|
99
|
-
*
|
|
96
|
+
* Obtains an instance of `Interval` from a text string such as
|
|
97
|
+
* `2007-12-03T10:15:30Z/2007-12-04T10:15:30Z`, where the end instant is exclusive.
|
|
98
|
+
*
|
|
100
99
|
* The string must consist of one of the following three formats:
|
|
101
|
-
*
|
|
102
|
-
* <li>a representations of an {@link ZonedDateTime}, followed by a forward slash,
|
|
100
|
+
* - a representations of an {@link ZonedDateTime}, followed by a forward slash,
|
|
103
101
|
* followed by a representation of a {@link ZonedDateTime}
|
|
104
|
-
*
|
|
102
|
+
* - a representation of an {@link ZonedDateTime}, followed by a forward slash,
|
|
105
103
|
* followed by a representation of a {@link Duration}
|
|
106
|
-
*
|
|
104
|
+
* - a representation of a {@link Duration}, followed by a forward slash,
|
|
107
105
|
* followed by a representation of an {@link ZonedDateTime}
|
|
108
|
-
* </ul>
|
|
109
106
|
*
|
|
110
107
|
* NOTE: in contrast to the threeten-extra base we are not using `OffsetDateTime` but `ZonedDateTime` to parse
|
|
111
108
|
* the string, this does not change the format but adds the possibility to optionally specify a zone
|
|
112
109
|
*
|
|
113
|
-
* @param {string} text
|
|
110
|
+
* @param {string} text - the text to parse, not null
|
|
114
111
|
* @return {Interval} the parsed interval, not null
|
|
115
|
-
* @throws DateTimeParseException if the text cannot be parsed
|
|
112
|
+
* @throws {DateTimeParseException} if the text cannot be parsed
|
|
116
113
|
*/
|
|
117
114
|
static parse(text) {
|
|
118
115
|
requireNonNull(text, 'text');
|
|
@@ -148,8 +145,9 @@ export class Interval {
|
|
|
148
145
|
/**
|
|
149
146
|
* Constructor.
|
|
150
147
|
*
|
|
151
|
-
* @param {Instant} startInclusive
|
|
152
|
-
* @param {Instant} endExclusive
|
|
148
|
+
* @param {Instant} startInclusive - the start instant, inclusive, validated not null
|
|
149
|
+
* @param {Instant} endExclusive - the end instant, exclusive, validated not null
|
|
150
|
+
* @private
|
|
153
151
|
*/
|
|
154
152
|
constructor(startInclusive, endExclusive) {
|
|
155
153
|
this._start = startInclusive;
|
|
@@ -159,7 +157,7 @@ export class Interval {
|
|
|
159
157
|
//-----------------------------------------------------------------------
|
|
160
158
|
/**
|
|
161
159
|
* Gets the start of this time interval, inclusive.
|
|
162
|
-
*
|
|
160
|
+
*
|
|
163
161
|
* This will return {@link Instant#MIN} if the range is unbounded at the start.
|
|
164
162
|
* In this case, the range includes all dates into the far-past.
|
|
165
163
|
*
|
|
@@ -171,7 +169,7 @@ export class Interval {
|
|
|
171
169
|
|
|
172
170
|
/**
|
|
173
171
|
* Gets the end of this time interval, exclusive.
|
|
174
|
-
*
|
|
172
|
+
*
|
|
175
173
|
* This will return {@link Instant#MAX} if the range is unbounded at the end.
|
|
176
174
|
* In this case, the range includes all dates into the far-future.
|
|
177
175
|
*
|
|
@@ -184,7 +182,7 @@ export class Interval {
|
|
|
184
182
|
//-----------------------------------------------------------------------
|
|
185
183
|
/**
|
|
186
184
|
* Checks if the range is empty.
|
|
187
|
-
*
|
|
185
|
+
*
|
|
188
186
|
* An empty range occurs when the start date equals the inclusive end date.
|
|
189
187
|
*
|
|
190
188
|
* @return {boolean} true if the range is empty
|
|
@@ -215,9 +213,9 @@ export class Interval {
|
|
|
215
213
|
/**
|
|
216
214
|
* Returns a copy of this range with the specified start instant.
|
|
217
215
|
*
|
|
218
|
-
* @param {Instant} start
|
|
216
|
+
* @param {Instant} start - the start instant for the new interval, not null
|
|
219
217
|
* @return {Interval} an interval with the end from this interval and the specified start
|
|
220
|
-
* @throws DateTimeException if the resulting interval has end before start
|
|
218
|
+
* @throws {DateTimeException} if the resulting interval has end before start
|
|
221
219
|
*/
|
|
222
220
|
withStart(start) {
|
|
223
221
|
return Interval.of(start, this._end);
|
|
@@ -226,9 +224,9 @@ export class Interval {
|
|
|
226
224
|
/**
|
|
227
225
|
* Returns a copy of this range with the specified end instant.
|
|
228
226
|
*
|
|
229
|
-
* @param {Instant} end
|
|
227
|
+
* @param {Instant} end - the end instant for the new interval, not null
|
|
230
228
|
* @return {Interval} an interval with the start from this interval and the specified end
|
|
231
|
-
* @throws DateTimeException if the resulting interval has end before start
|
|
229
|
+
* @throws {DateTimeException} if the resulting interval has end before start
|
|
232
230
|
*/
|
|
233
231
|
withEnd(end) {
|
|
234
232
|
return Interval.of(this._start, end);
|
|
@@ -237,13 +235,13 @@ export class Interval {
|
|
|
237
235
|
//-----------------------------------------------------------------------
|
|
238
236
|
/**
|
|
239
237
|
* Checks if this interval contains the specified instant.
|
|
240
|
-
*
|
|
238
|
+
*
|
|
241
239
|
* This checks if the specified instant is within the bounds of this interval.
|
|
242
|
-
* If this range has an unbounded start then
|
|
243
|
-
* If this range has an unbounded end then
|
|
240
|
+
* If this range has an unbounded start then `contains(Instant.MIN)` returns true.
|
|
241
|
+
* If this range has an unbounded end then `contains(Instant.MAX)` returns true.
|
|
244
242
|
* If this range is empty then this method always returns false.
|
|
245
243
|
*
|
|
246
|
-
* @param {Instant} instant
|
|
244
|
+
* @param {Instant} instant - the instant, not null
|
|
247
245
|
* @return {boolean} true if this interval contains the instant
|
|
248
246
|
*/
|
|
249
247
|
contains(instant) {
|
|
@@ -254,11 +252,11 @@ export class Interval {
|
|
|
254
252
|
|
|
255
253
|
/**
|
|
256
254
|
* Checks if this interval encloses the specified interval.
|
|
257
|
-
*
|
|
255
|
+
*
|
|
258
256
|
* This checks if the bounds of the specified interval are within the bounds of this interval.
|
|
259
257
|
* An empty interval encloses itself.
|
|
260
258
|
*
|
|
261
|
-
* @param {Interval} other
|
|
259
|
+
* @param {Interval} other - the other interval, not null
|
|
262
260
|
* @return {boolean} true if this interval contains the other interval
|
|
263
261
|
*/
|
|
264
262
|
encloses(other) {
|
|
@@ -269,11 +267,11 @@ export class Interval {
|
|
|
269
267
|
|
|
270
268
|
/**
|
|
271
269
|
* Checks if this interval abuts the specified interval.
|
|
272
|
-
*
|
|
270
|
+
*
|
|
273
271
|
* The result is true if the end of this interval is the start of the other, or vice versa.
|
|
274
272
|
* An empty interval does not abut itself.
|
|
275
273
|
*
|
|
276
|
-
* @param {Interval} other
|
|
274
|
+
* @param {Interval} other - the other interval, not null
|
|
277
275
|
* @return {boolean} true if this interval abuts the other interval
|
|
278
276
|
*/
|
|
279
277
|
abuts(other) {
|
|
@@ -284,13 +282,13 @@ export class Interval {
|
|
|
284
282
|
|
|
285
283
|
/**
|
|
286
284
|
* Checks if this interval is connected to the specified interval.
|
|
287
|
-
*
|
|
285
|
+
*
|
|
288
286
|
* The result is true if the two intervals have an enclosed interval in common, even if that interval is empty.
|
|
289
287
|
* An empty interval is connected to itself.
|
|
290
|
-
*
|
|
291
|
-
* This is equivalent to
|
|
288
|
+
*
|
|
289
|
+
* This is equivalent to `(overlaps(other) || abuts(other))`.
|
|
292
290
|
*
|
|
293
|
-
* @param {Interval} other
|
|
291
|
+
* @param {Interval} other - the other interval, not null
|
|
294
292
|
* @return {boolean} true if this interval is connected to the other interval
|
|
295
293
|
*/
|
|
296
294
|
isConnected(other) {
|
|
@@ -301,13 +299,13 @@ export class Interval {
|
|
|
301
299
|
|
|
302
300
|
/**
|
|
303
301
|
* Checks if this interval overlaps the specified interval.
|
|
304
|
-
*
|
|
302
|
+
*
|
|
305
303
|
* The result is true if the the two intervals share some part of the time-line.
|
|
306
304
|
* An empty interval overlaps itself.
|
|
307
|
-
*
|
|
308
|
-
* This is equivalent to
|
|
305
|
+
*
|
|
306
|
+
* This is equivalent to `(isConnected(other) && !abuts(other))`.
|
|
309
307
|
*
|
|
310
|
-
* @param {Interval} other
|
|
308
|
+
* @param {Interval} other - the time interval to compare to, null means a zero length interval now
|
|
311
309
|
* @return {boolean} true if the time intervals overlap
|
|
312
310
|
*/
|
|
313
311
|
overlaps(other) {
|
|
@@ -319,13 +317,13 @@ export class Interval {
|
|
|
319
317
|
//-----------------------------------------------------------------------
|
|
320
318
|
/**
|
|
321
319
|
* Calculates the interval that is the intersection of this interval and the specified interval.
|
|
322
|
-
*
|
|
320
|
+
*
|
|
323
321
|
* This finds the intersection of two intervals.
|
|
324
322
|
* This throws an exception if the two intervals are not {@linkplain #isConnected(Interval) connected}.
|
|
325
323
|
*
|
|
326
|
-
* @param {Interval} other
|
|
324
|
+
* @param {Interval} other - the other interval to check for, not null
|
|
327
325
|
* @return {Interval} the interval that is the intersection of the two intervals
|
|
328
|
-
* @throws DateTimeException if the intervals do not connect
|
|
326
|
+
* @throws {DateTimeException} if the intervals do not connect
|
|
329
327
|
*/
|
|
330
328
|
intersection(other) {
|
|
331
329
|
requireNonNull(other, 'other');
|
|
@@ -348,13 +346,13 @@ export class Interval {
|
|
|
348
346
|
|
|
349
347
|
/**
|
|
350
348
|
* Calculates the interval that is the union of this interval and the specified interval.
|
|
351
|
-
*
|
|
349
|
+
*
|
|
352
350
|
* This finds the union of two intervals.
|
|
353
351
|
* This throws an exception if the two intervals are not {@linkplain #isConnected(Interval) connected}.
|
|
354
352
|
*
|
|
355
|
-
* @param {Interval} other
|
|
353
|
+
* @param {Interval} other - the other interval to check for, not null
|
|
356
354
|
* @return {Interval} the interval that is the union of the two intervals
|
|
357
|
-
* @throws DateTimeException if the intervals do not connect
|
|
355
|
+
* @throws {DateTimeException} if the intervals do not connect
|
|
358
356
|
*/
|
|
359
357
|
union(other) {
|
|
360
358
|
requireNonNull(other, 'other');
|
|
@@ -377,11 +375,11 @@ export class Interval {
|
|
|
377
375
|
|
|
378
376
|
/**
|
|
379
377
|
* Calculates the smallest interval that encloses this interval and the specified interval.
|
|
380
|
-
*
|
|
378
|
+
*
|
|
381
379
|
* The result of this method will {@linkplain #encloses(Interval) enclose}
|
|
382
380
|
* this interval and the specified interval.
|
|
383
381
|
*
|
|
384
|
-
* @param {Interval} other
|
|
382
|
+
* @param {Interval} other - the other interval to check for, not null
|
|
385
383
|
* @return {Interval} the interval that spans the two intervals
|
|
386
384
|
*/
|
|
387
385
|
span(other) {
|
|
@@ -396,14 +394,12 @@ export class Interval {
|
|
|
396
394
|
|
|
397
395
|
//-------------------------------------------------------------------------
|
|
398
396
|
/**
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
397
|
+
* Function overloading for {@link Interval#isAfter}
|
|
398
|
+
* - If called with an Instant, then {@link Interval#isAfterInstant} is executed.
|
|
399
|
+
* - Otherwise {@link Interval#isAfterInterval} is executed.
|
|
402
400
|
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
* @param {!(Instant|Interval)} instantOrInterval
|
|
406
|
-
* @returns {boolean}
|
|
401
|
+
* @param {Instant|Interval} instantOrInterval
|
|
402
|
+
* @return {boolean}
|
|
407
403
|
*/
|
|
408
404
|
isAfter(instantOrInterval) {
|
|
409
405
|
if (instantOrInterval instanceof Instant) {
|
|
@@ -414,14 +410,12 @@ export class Interval {
|
|
|
414
410
|
}
|
|
415
411
|
|
|
416
412
|
/**
|
|
417
|
-
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
* Otherwise {@link Interval#isBeforeInterval} is executed.
|
|
413
|
+
* Function overloading for {@link Interval#isBefore}
|
|
414
|
+
* - If called with an Instant, then {@link Interval#isBeforeInstant} is executed.
|
|
415
|
+
* - Otherwise {@link Interval#isBeforeInterval} is executed.
|
|
422
416
|
*
|
|
423
|
-
* @param {
|
|
424
|
-
* @
|
|
417
|
+
* @param {Instant|Interval} instantOrInterval
|
|
418
|
+
* @return {boolean}
|
|
425
419
|
*/
|
|
426
420
|
isBefore(instantOrInterval) {
|
|
427
421
|
if (instantOrInterval instanceof Instant) {
|
|
@@ -433,11 +427,11 @@ export class Interval {
|
|
|
433
427
|
|
|
434
428
|
/**
|
|
435
429
|
* Checks if this interval is after the specified instant.
|
|
436
|
-
*
|
|
430
|
+
*
|
|
437
431
|
* The result is true if the this instant starts after the specified instant.
|
|
438
432
|
* An empty interval behaves as though it is an instant for comparison purposes.
|
|
439
433
|
*
|
|
440
|
-
* @param {Instant} instant
|
|
434
|
+
* @param {Instant} instant - the other instant to compare to, not null
|
|
441
435
|
* @return {boolean} true if the start of this interval is after the specified instant
|
|
442
436
|
*/
|
|
443
437
|
isAfterInstant(instant) {
|
|
@@ -446,13 +440,13 @@ export class Interval {
|
|
|
446
440
|
|
|
447
441
|
/**
|
|
448
442
|
* Checks if this interval is before the specified instant.
|
|
449
|
-
*
|
|
443
|
+
*
|
|
450
444
|
* The result is true if the this instant ends before the specified instant.
|
|
451
445
|
* Since intervals do not include their end points, this will return true if the
|
|
452
446
|
* instant equals the end of the interval.
|
|
453
447
|
* An empty interval behaves as though it is an instant for comparison purposes.
|
|
454
448
|
*
|
|
455
|
-
* @param {Instant} instant
|
|
449
|
+
* @param {Instant} instant - the other instant to compare to, not null
|
|
456
450
|
* @return {boolean} true if the start of this interval is before the specified instant
|
|
457
451
|
*/
|
|
458
452
|
isBeforeInstant(instant) {
|
|
@@ -462,13 +456,13 @@ export class Interval {
|
|
|
462
456
|
//-------------------------------------------------------------------------
|
|
463
457
|
/**
|
|
464
458
|
* Checks if this interval is after the specified interval.
|
|
465
|
-
*
|
|
459
|
+
*
|
|
466
460
|
* The result is true if the this instant starts after the end of the specified interval.
|
|
467
461
|
* Since intervals do not include their end points, this will return true if the
|
|
468
462
|
* instant equals the end of the interval.
|
|
469
463
|
* An empty interval behaves as though it is an instant for comparison purposes.
|
|
470
464
|
*
|
|
471
|
-
* @param {Interval} interval
|
|
465
|
+
* @param {Interval} interval - the other interval to compare to, not null
|
|
472
466
|
* @return {boolean} true if this instant is after the specified instant
|
|
473
467
|
*/
|
|
474
468
|
isAfterInterval(interval) {
|
|
@@ -477,13 +471,13 @@ export class Interval {
|
|
|
477
471
|
|
|
478
472
|
/**
|
|
479
473
|
* Checks if this interval is before the specified interval.
|
|
480
|
-
*
|
|
474
|
+
*
|
|
481
475
|
* The result is true if the this instant ends before the start of the specified interval.
|
|
482
476
|
* Since intervals do not include their end points, this will return true if the
|
|
483
477
|
* two intervals abut.
|
|
484
478
|
* An empty interval behaves as though it is an instant for comparison purposes.
|
|
485
479
|
*
|
|
486
|
-
* @param {Interval} interval
|
|
480
|
+
* @param {Interval} interval - the other interval to compare to, not null
|
|
487
481
|
* @return {boolean} true if this instant is before the specified instant
|
|
488
482
|
*/
|
|
489
483
|
isBeforeInterval(interval) {
|
|
@@ -493,12 +487,12 @@ export class Interval {
|
|
|
493
487
|
//-----------------------------------------------------------------------
|
|
494
488
|
/**
|
|
495
489
|
* Obtains the duration of this interval.
|
|
496
|
-
*
|
|
497
|
-
* An
|
|
498
|
-
* A
|
|
490
|
+
*
|
|
491
|
+
* An `Interval` is associated with two specific instants on the time-line.
|
|
492
|
+
* A `Duration` is simply an amount of time, separate from the time-line.
|
|
499
493
|
*
|
|
500
494
|
* @return {Duration} the duration of the time interval
|
|
501
|
-
* @throws ArithmeticException if the calculation exceeds the capacity of
|
|
495
|
+
* @throws {ArithmeticException} if the calculation exceeds the capacity of `Duration`
|
|
502
496
|
*/
|
|
503
497
|
toDuration() {
|
|
504
498
|
return Duration.between(this._start, this._end);
|
|
@@ -507,11 +501,11 @@ export class Interval {
|
|
|
507
501
|
//-----------------------------------------------------------------------
|
|
508
502
|
/**
|
|
509
503
|
* Checks if this interval is equal to another interval.
|
|
510
|
-
*
|
|
511
|
-
* Compares this
|
|
512
|
-
* Only objects of type
|
|
504
|
+
*
|
|
505
|
+
* Compares this `Interval` with another ensuring that the two instants are the same.
|
|
506
|
+
* Only objects of type `Interval` are compared, other types return false.
|
|
513
507
|
*
|
|
514
|
-
* @param {*} obj
|
|
508
|
+
* @param {*} obj - the object to check, null returns false
|
|
515
509
|
* @return {boolean} true if this is equal to the other interval
|
|
516
510
|
*/
|
|
517
511
|
equals(obj) {
|
|
@@ -536,10 +530,10 @@ export class Interval {
|
|
|
536
530
|
|
|
537
531
|
//-----------------------------------------------------------------------
|
|
538
532
|
/**
|
|
539
|
-
* Outputs this interval as a
|
|
540
|
-
*
|
|
533
|
+
* Outputs this interval as a `String`, such as `2007-12-03T10:15:30/2007-12-04T10:15:30`.
|
|
534
|
+
*
|
|
541
535
|
* The output will be the ISO-8601 format formed by combining the
|
|
542
|
-
*
|
|
536
|
+
* `toString()` methods of the two instants, separated by a forward slash.
|
|
543
537
|
*
|
|
544
538
|
* @return {string} a string representation of this instant, not null
|
|
545
539
|
*/
|