@js-joda/extra 0.10.2 → 0.11.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/README.md +1 -1
- package/dist/js-joda-extra.esm.js +208 -619
- package/dist/js-joda-extra.esm.js.map +1 -1
- package/dist/js-joda-extra.js +207 -619
- package/dist/js-joda-extra.js.map +1 -1
- package/dist/js-joda-extra.min.js +2 -2
- package/package.json +4 -4
- package/src/Temporals.js +296 -0
- package/src/_init.js +2 -0
- package/src/js-joda-extra.js +2 -0
- package/src/plug.js +2 -0
- package/typings/js-joda-extra.d.ts +12 -2
package/dist/js-joda-extra.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//! @version @js-joda/extra - 0.
|
|
1
|
+
//! @version @js-joda/extra - 0.11.0
|
|
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)
|
|
@@ -12,16 +12,13 @@
|
|
|
12
12
|
function _inheritsLoose(subClass, superClass) {
|
|
13
13
|
subClass.prototype = Object.create(superClass.prototype);
|
|
14
14
|
subClass.prototype.constructor = subClass;
|
|
15
|
-
|
|
16
15
|
_setPrototypeOf(subClass, superClass);
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
function _setPrototypeOf(o, p) {
|
|
20
|
-
_setPrototypeOf = Object.setPrototypeOf
|
|
18
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
21
19
|
o.__proto__ = p;
|
|
22
20
|
return o;
|
|
23
21
|
};
|
|
24
|
-
|
|
25
22
|
return _setPrototypeOf(o, p);
|
|
26
23
|
}
|
|
27
24
|
|
|
@@ -42,57 +39,45 @@
|
|
|
42
39
|
if (value == null) {
|
|
43
40
|
throw new core.NullPointerException(parameterName + " must not be null");
|
|
44
41
|
}
|
|
45
|
-
|
|
46
42
|
return value;
|
|
47
43
|
}
|
|
48
44
|
function requireInstance(value, _class, parameterName) {
|
|
49
45
|
if (!(value instanceof _class)) {
|
|
50
46
|
throw new core.IllegalArgumentException(parameterName + " must be an instance of " + (_class.name ? _class.name : _class) + (value && value.constructor && value.constructor.name ? ", but is " + value.constructor.name : ''));
|
|
51
47
|
}
|
|
52
|
-
|
|
53
48
|
return value;
|
|
54
49
|
}
|
|
55
50
|
|
|
56
|
-
var MathUtil$
|
|
51
|
+
var MathUtil$6 = core._.MathUtil;
|
|
57
52
|
var DayOfMonth = function (_TemporalAccessor) {
|
|
58
53
|
_inheritsLoose(DayOfMonth, _TemporalAccessor);
|
|
59
|
-
|
|
60
54
|
DayOfMonth.now = function now(zoneIdOrClock) {
|
|
61
55
|
switch (arguments.length) {
|
|
62
56
|
case 0:
|
|
63
57
|
return DayOfMonth._now0();
|
|
64
|
-
|
|
65
58
|
case 1:
|
|
66
59
|
requireNonNull(zoneIdOrClock, 'clockOrZone');
|
|
67
|
-
|
|
68
60
|
if (zoneIdOrClock instanceof core.ZoneId) {
|
|
69
61
|
return DayOfMonth._nowZoneId(zoneIdOrClock);
|
|
70
62
|
}
|
|
71
|
-
|
|
72
63
|
if (zoneIdOrClock instanceof core.Clock) {
|
|
73
64
|
return DayOfMonth._nowClock(zoneIdOrClock);
|
|
74
65
|
}
|
|
75
|
-
|
|
76
66
|
throw new core.IllegalArgumentException("zoneIdOrClock must be an instance of ZoneId or Clock, but is " + zoneIdOrClock.constructor.name);
|
|
77
|
-
|
|
78
67
|
default:
|
|
79
68
|
throw new core.IllegalArgumentException("Invalid number of arguments: " + arguments.length);
|
|
80
69
|
}
|
|
81
70
|
};
|
|
82
|
-
|
|
83
71
|
DayOfMonth._now0 = function _now0() {
|
|
84
72
|
return this.now(core.Clock.systemDefaultZone());
|
|
85
73
|
};
|
|
86
|
-
|
|
87
74
|
DayOfMonth._nowZoneId = function _nowZoneId(zone) {
|
|
88
75
|
return this.now(core.Clock.system(zone));
|
|
89
76
|
};
|
|
90
|
-
|
|
91
77
|
DayOfMonth._nowClock = function _nowClock(clock) {
|
|
92
78
|
var now = core.LocalDate.now(clock);
|
|
93
79
|
return DayOfMonth.of(now.dayOfMonth());
|
|
94
80
|
};
|
|
95
|
-
|
|
96
81
|
DayOfMonth.of = function of(dayOfMonth) {
|
|
97
82
|
if (1 <= dayOfMonth && dayOfMonth <= 31) {
|
|
98
83
|
return DayOfMonth.VALUES[dayOfMonth - 1];
|
|
@@ -100,180 +85,138 @@
|
|
|
100
85
|
throw new core.DateTimeException("Invalid value for DayOfMonth: " + dayOfMonth);
|
|
101
86
|
}
|
|
102
87
|
};
|
|
103
|
-
|
|
104
88
|
DayOfMonth.from = function from(temporal) {
|
|
105
89
|
if (temporal instanceof DayOfMonth) {
|
|
106
90
|
return temporal;
|
|
107
91
|
}
|
|
108
|
-
|
|
109
92
|
requireNonNull(temporal, 'temporal');
|
|
110
|
-
|
|
111
93
|
try {
|
|
112
94
|
return DayOfMonth.of(temporal.get(core.ChronoField.DAY_OF_MONTH));
|
|
113
95
|
} catch (ex) {
|
|
114
96
|
throw new core.DateTimeException("Unable to obtain DayOfMonth from TemporalAccessor: " + temporal + " of type " + temporal.constructor.name, ex);
|
|
115
97
|
}
|
|
116
98
|
};
|
|
117
|
-
|
|
118
99
|
function DayOfMonth(dayOfMonth) {
|
|
119
100
|
var _this;
|
|
120
|
-
|
|
121
101
|
_this = _TemporalAccessor.call(this) || this;
|
|
122
|
-
_this._day = MathUtil$
|
|
102
|
+
_this._day = MathUtil$6.safeToInt(dayOfMonth);
|
|
123
103
|
return _this;
|
|
124
104
|
}
|
|
125
|
-
|
|
126
105
|
var _proto = DayOfMonth.prototype;
|
|
127
|
-
|
|
128
106
|
_proto.value = function value() {
|
|
129
107
|
return this._day;
|
|
130
108
|
};
|
|
131
|
-
|
|
132
109
|
_proto.isSupported = function isSupported(field) {
|
|
133
110
|
if (field instanceof core.ChronoField) {
|
|
134
111
|
return field === core.ChronoField.DAY_OF_MONTH;
|
|
135
112
|
}
|
|
136
|
-
|
|
137
113
|
return field != null && field.isSupportedBy(this);
|
|
138
114
|
};
|
|
139
|
-
|
|
140
115
|
_proto.range = function range(field) {
|
|
141
116
|
requireNonNull(field, 'field');
|
|
142
|
-
|
|
143
117
|
if (field === core.ChronoField.DAY_OF_MONTH) {
|
|
144
118
|
return field.range();
|
|
145
119
|
}
|
|
146
|
-
|
|
147
120
|
return _TemporalAccessor.prototype.range.call(this, field);
|
|
148
121
|
};
|
|
149
|
-
|
|
150
122
|
_proto.get = function get(field) {
|
|
151
123
|
return this.range(field).checkValidIntValue(this.getLong(field), field);
|
|
152
124
|
};
|
|
153
|
-
|
|
154
125
|
_proto.getLong = function getLong(field) {
|
|
155
126
|
requireNonNull(field, 'field');
|
|
156
|
-
|
|
157
127
|
if (field === core.ChronoField.DAY_OF_MONTH) {
|
|
158
128
|
return this._day;
|
|
159
129
|
} else if (field instanceof core.ChronoField) {
|
|
160
130
|
throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
|
|
161
131
|
}
|
|
162
|
-
|
|
163
132
|
return field.getFrom(this);
|
|
164
133
|
};
|
|
165
|
-
|
|
166
134
|
_proto.isValidYearMonth = function isValidYearMonth(yearMonth) {
|
|
167
135
|
return yearMonth != null && yearMonth.isValidDay(this._day);
|
|
168
136
|
};
|
|
169
|
-
|
|
170
137
|
_proto.query = function query(_query) {
|
|
171
138
|
requireNonNull(_query, 'query');
|
|
172
139
|
requireInstance(_query, core.TemporalQuery, 'query');
|
|
173
|
-
|
|
174
140
|
if (_query === core.TemporalQueries.chronology()) {
|
|
175
141
|
return core.IsoChronology.INSTANCE;
|
|
176
142
|
}
|
|
177
|
-
|
|
178
143
|
return _TemporalAccessor.prototype.query.call(this, _query);
|
|
179
144
|
};
|
|
180
|
-
|
|
181
145
|
_proto.adjustInto = function adjustInto(temporal) {
|
|
182
146
|
requireNonNull(temporal, 'temporal');
|
|
183
147
|
return temporal.with(core.ChronoField.DAY_OF_MONTH, this._day);
|
|
184
148
|
};
|
|
185
|
-
|
|
186
149
|
_proto.atMonth = function atMonth(month) {
|
|
187
150
|
requireNonNull(month, 'month');
|
|
188
|
-
|
|
189
151
|
if (month instanceof core.Month) {
|
|
190
152
|
return core.MonthDay.of(month, Math.min(this._day, month.maxLength()));
|
|
191
153
|
} else {
|
|
192
154
|
return core.MonthDay.of(month, Math.min(this._day, core.Month.of(month).maxLength()));
|
|
193
155
|
}
|
|
194
156
|
};
|
|
195
|
-
|
|
196
157
|
_proto.atYearMonth = function atYearMonth(yearMonth) {
|
|
197
158
|
requireNonNull(yearMonth, 'yearMonth');
|
|
198
159
|
return yearMonth.atDay(Math.min(this._day, yearMonth.lengthOfMonth()));
|
|
199
160
|
};
|
|
200
|
-
|
|
201
161
|
_proto.compareTo = function compareTo(other) {
|
|
202
162
|
requireNonNull(other, 'other');
|
|
203
163
|
requireInstance(other, DayOfMonth, 'other');
|
|
204
164
|
return this._day - other._day;
|
|
205
165
|
};
|
|
206
|
-
|
|
207
166
|
_proto.equals = function equals(obj) {
|
|
208
167
|
if (this === obj) {
|
|
209
168
|
return true;
|
|
210
169
|
}
|
|
211
|
-
|
|
212
170
|
if (obj instanceof DayOfMonth) {
|
|
213
171
|
return this._day === obj._day;
|
|
214
172
|
}
|
|
215
|
-
|
|
216
173
|
return false;
|
|
217
174
|
};
|
|
218
|
-
|
|
219
175
|
_proto.hashCode = function hashCode() {
|
|
220
176
|
return this._day;
|
|
221
177
|
};
|
|
222
|
-
|
|
223
178
|
_proto.toString = function toString() {
|
|
224
179
|
return "DayOfMonth:" + this._day;
|
|
225
180
|
};
|
|
226
|
-
|
|
227
181
|
return DayOfMonth;
|
|
228
182
|
}(core.TemporalAccessor);
|
|
229
|
-
function _init$
|
|
183
|
+
function _init$8() {
|
|
230
184
|
DayOfMonth.VALUES = new Array(31);
|
|
231
|
-
|
|
232
185
|
for (var i = 0; i < 31; i++) {
|
|
233
186
|
DayOfMonth.VALUES[i] = new DayOfMonth(i + 1);
|
|
234
187
|
}
|
|
235
188
|
}
|
|
236
189
|
|
|
237
|
-
var MathUtil$
|
|
190
|
+
var MathUtil$5 = core._.MathUtil;
|
|
238
191
|
var DayOfYear = function (_TemporalAccessor) {
|
|
239
192
|
_inheritsLoose(DayOfYear, _TemporalAccessor);
|
|
240
|
-
|
|
241
193
|
DayOfYear.now = function now(zoneIdOrClock) {
|
|
242
194
|
switch (arguments.length) {
|
|
243
195
|
case 0:
|
|
244
196
|
return DayOfYear._now0();
|
|
245
|
-
|
|
246
197
|
case 1:
|
|
247
198
|
requireNonNull(zoneIdOrClock, 'clockOrZone');
|
|
248
|
-
|
|
249
199
|
if (zoneIdOrClock instanceof core.ZoneId) {
|
|
250
200
|
return DayOfYear._nowZoneId(zoneIdOrClock);
|
|
251
201
|
}
|
|
252
|
-
|
|
253
202
|
if (zoneIdOrClock instanceof core.Clock) {
|
|
254
203
|
return DayOfYear._nowClock(zoneIdOrClock);
|
|
255
204
|
}
|
|
256
|
-
|
|
257
205
|
throw new core.IllegalArgumentException("zoneIdOrClock must be an instance of ZoneId or Clock, but is " + zoneIdOrClock.constructor.name);
|
|
258
|
-
|
|
259
206
|
default:
|
|
260
207
|
throw new core.IllegalArgumentException("Invalid number of arguments: " + arguments.length);
|
|
261
208
|
}
|
|
262
209
|
};
|
|
263
|
-
|
|
264
210
|
DayOfYear._now0 = function _now0() {
|
|
265
211
|
return DayOfYear.now(core.Clock.systemDefaultZone());
|
|
266
212
|
};
|
|
267
|
-
|
|
268
213
|
DayOfYear._nowZoneId = function _nowZoneId(zone) {
|
|
269
214
|
return DayOfYear.now(core.Clock.system(zone));
|
|
270
215
|
};
|
|
271
|
-
|
|
272
216
|
DayOfYear._nowClock = function _nowClock(clock) {
|
|
273
217
|
var now = core.LocalDate.now(clock);
|
|
274
218
|
return DayOfYear.of(now.dayOfYear());
|
|
275
219
|
};
|
|
276
|
-
|
|
277
220
|
DayOfYear.of = function of(dayOfYear) {
|
|
278
221
|
if (1 <= dayOfYear && dayOfYear <= 366) {
|
|
279
222
|
return DayOfYear.VALUES[dayOfYear - 1];
|
|
@@ -281,131 +224,100 @@
|
|
|
281
224
|
throw new core.DateTimeException("Invalid value for DayOfYear: " + dayOfYear);
|
|
282
225
|
}
|
|
283
226
|
};
|
|
284
|
-
|
|
285
227
|
DayOfYear.from = function from(temporal) {
|
|
286
228
|
requireNonNull(temporal, 'temporal');
|
|
287
229
|
requireInstance(temporal, core.TemporalAccessor, 'temporal');
|
|
288
|
-
|
|
289
230
|
if (temporal instanceof DayOfYear) {
|
|
290
231
|
return temporal;
|
|
291
232
|
}
|
|
292
|
-
|
|
293
233
|
try {
|
|
294
234
|
return DayOfYear.of(temporal.get(core.ChronoField.DAY_OF_YEAR));
|
|
295
235
|
} catch (ex) {
|
|
296
236
|
throw new core.DateTimeException("Unable to obtain DayOfYear from TemporalAccessor: " + temporal + " of type " + temporal.constructor.name, ex);
|
|
297
237
|
}
|
|
298
238
|
};
|
|
299
|
-
|
|
300
239
|
function DayOfYear(dayOfYear) {
|
|
301
240
|
var _this;
|
|
302
|
-
|
|
303
241
|
_this = _TemporalAccessor.call(this) || this;
|
|
304
|
-
_this._day = MathUtil$
|
|
242
|
+
_this._day = MathUtil$5.safeToInt(dayOfYear);
|
|
305
243
|
return _this;
|
|
306
244
|
}
|
|
307
|
-
|
|
308
245
|
var _proto = DayOfYear.prototype;
|
|
309
|
-
|
|
310
246
|
_proto.value = function value() {
|
|
311
247
|
return this._day;
|
|
312
248
|
};
|
|
313
|
-
|
|
314
249
|
_proto.isSupported = function isSupported(field) {
|
|
315
250
|
if (field instanceof core.ChronoField) {
|
|
316
251
|
return field === core.ChronoField.DAY_OF_YEAR;
|
|
317
252
|
}
|
|
318
|
-
|
|
319
253
|
return field != null && field.isSupportedBy(this);
|
|
320
254
|
};
|
|
321
|
-
|
|
322
255
|
_proto.range = function range(field) {
|
|
323
256
|
requireNonNull(field, 'field');
|
|
324
|
-
|
|
325
257
|
if (field === core.ChronoField.DAY_OF_YEAR) {
|
|
326
258
|
return field.range();
|
|
327
259
|
}
|
|
328
|
-
|
|
329
260
|
return _TemporalAccessor.prototype.range.call(this, field);
|
|
330
261
|
};
|
|
331
|
-
|
|
332
262
|
_proto.get = function get(field) {
|
|
333
263
|
return this.range(field).checkValidIntValue(this.getLong(field), field);
|
|
334
264
|
};
|
|
335
|
-
|
|
336
265
|
_proto.getLong = function getLong(field) {
|
|
337
266
|
requireNonNull(field, 'field');
|
|
338
|
-
|
|
339
267
|
if (field === core.ChronoField.DAY_OF_YEAR) {
|
|
340
268
|
return this._day;
|
|
341
269
|
} else if (field instanceof core.ChronoField) {
|
|
342
270
|
throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
|
|
343
271
|
}
|
|
344
|
-
|
|
345
272
|
return field.getFrom(this);
|
|
346
273
|
};
|
|
347
|
-
|
|
348
274
|
_proto.isValidYear = function isValidYear(year) {
|
|
349
275
|
return this._day < 366 || core.Year.isLeap(year);
|
|
350
276
|
};
|
|
351
|
-
|
|
352
277
|
_proto.query = function query(_query) {
|
|
353
278
|
requireNonNull(_query, 'query');
|
|
354
279
|
requireInstance(_query, core.TemporalQuery, 'query');
|
|
355
|
-
|
|
356
280
|
if (_query === core.TemporalQueries.chronology()) {
|
|
357
281
|
return core.IsoChronology.INSTANCE;
|
|
358
282
|
}
|
|
359
|
-
|
|
360
283
|
return _TemporalAccessor.prototype.query.call(this, _query);
|
|
361
284
|
};
|
|
362
|
-
|
|
363
285
|
_proto.adjustInto = function adjustInto(temporal) {
|
|
364
286
|
requireNonNull(temporal, 'temporal');
|
|
365
287
|
return temporal.with(core.ChronoField.DAY_OF_YEAR, this._day);
|
|
366
288
|
};
|
|
367
|
-
|
|
368
289
|
_proto.atYear = function atYear(year) {
|
|
369
290
|
requireNonNull(year, 'year');
|
|
370
|
-
|
|
371
291
|
if (year instanceof core.Year) {
|
|
372
292
|
return year.atDay(this._day);
|
|
373
293
|
} else {
|
|
374
294
|
return core.LocalDate.ofYearDay(year, this._day);
|
|
375
295
|
}
|
|
376
296
|
};
|
|
377
|
-
|
|
378
297
|
_proto.compareTo = function compareTo(other) {
|
|
379
298
|
requireNonNull(other, 'other');
|
|
380
299
|
requireInstance(other, DayOfYear, 'other');
|
|
381
300
|
return this._day - other._day;
|
|
382
301
|
};
|
|
383
|
-
|
|
384
302
|
_proto.equals = function equals(obj) {
|
|
385
303
|
if (this === obj) {
|
|
386
304
|
return true;
|
|
387
305
|
}
|
|
388
|
-
|
|
389
306
|
if (obj instanceof DayOfYear) {
|
|
390
307
|
return this._day === obj._day;
|
|
391
308
|
}
|
|
392
|
-
|
|
393
309
|
return false;
|
|
394
310
|
};
|
|
395
|
-
|
|
396
311
|
_proto.hashCode = function hashCode() {
|
|
397
312
|
return this._day;
|
|
398
313
|
};
|
|
399
|
-
|
|
400
314
|
_proto.toString = function toString() {
|
|
401
315
|
return "DayOfYear:" + this._day;
|
|
402
316
|
};
|
|
403
|
-
|
|
404
317
|
return DayOfYear;
|
|
405
318
|
}(core.TemporalAccessor);
|
|
406
|
-
function _init$
|
|
319
|
+
function _init$7() {
|
|
407
320
|
DayOfYear.VALUES = new Array(366);
|
|
408
|
-
|
|
409
321
|
for (var i = 0; i < 366; i++) {
|
|
410
322
|
DayOfYear.VALUES[i] = new DayOfYear(i + 1);
|
|
411
323
|
}
|
|
@@ -424,148 +336,113 @@
|
|
|
424
336
|
return Interval.ofInstantInstant(startInstant, endInstantOrDuration);
|
|
425
337
|
}
|
|
426
338
|
};
|
|
427
|
-
|
|
428
339
|
Interval.ofInstantInstant = function ofInstantInstant(startInclusive, endExclusive) {
|
|
429
340
|
requireNonNull(startInclusive, 'startInclusive');
|
|
430
341
|
requireNonNull(endExclusive, 'endExclusive');
|
|
431
342
|
requireInstance(startInclusive, core.Instant, 'startInclusive');
|
|
432
343
|
requireInstance(endExclusive, core.Instant, 'endExclusive');
|
|
433
|
-
|
|
434
344
|
if (endExclusive.isBefore(startInclusive)) {
|
|
435
345
|
throw new core.DateTimeException('End instant must on or after start instant');
|
|
436
346
|
}
|
|
437
|
-
|
|
438
347
|
return new Interval(startInclusive, endExclusive);
|
|
439
348
|
};
|
|
440
|
-
|
|
441
349
|
Interval.ofInstantDuration = function ofInstantDuration(startInclusive, duration) {
|
|
442
350
|
requireNonNull(startInclusive, 'startInclusive');
|
|
443
351
|
requireNonNull(duration, 'duration');
|
|
444
352
|
requireInstance(startInclusive, core.Instant, 'startInclusive');
|
|
445
353
|
requireInstance(duration, core.Duration, 'duration');
|
|
446
|
-
|
|
447
354
|
if (duration.isNegative()) {
|
|
448
355
|
throw new core.DateTimeException('Duration must not be zero or negative');
|
|
449
356
|
}
|
|
450
|
-
|
|
451
357
|
return new Interval(startInclusive, startInclusive.plus(duration));
|
|
452
358
|
};
|
|
453
|
-
|
|
454
359
|
Interval.parse = function parse(text) {
|
|
455
360
|
requireNonNull(text, 'text');
|
|
456
|
-
|
|
457
361
|
if (!(typeof text === 'string')) {
|
|
458
362
|
throw new core.IllegalArgumentException("text must be a string, but is " + text.constructor.name);
|
|
459
363
|
}
|
|
460
|
-
|
|
461
364
|
for (var i = 0; i < text.length; i += 1) {
|
|
462
365
|
if (text.charAt(i) === '/') {
|
|
463
366
|
var firstChar = text.charAt(0);
|
|
464
|
-
|
|
465
367
|
if (firstChar === 'P' || firstChar === 'p') {
|
|
466
368
|
var duration = core.Duration.parse(text.substring(0, i));
|
|
467
369
|
var end = core.ZonedDateTime.parse(text.substring(i + 1, text.length)).toInstant();
|
|
468
370
|
return Interval.of(end.minus(duration), end);
|
|
469
371
|
} else {
|
|
470
372
|
var start = core.ZonedDateTime.parse(text.substring(0, i)).toInstant();
|
|
471
|
-
|
|
472
373
|
if (i + 1 < text.length) {
|
|
473
374
|
var c = text.charAt(i + 1);
|
|
474
|
-
|
|
475
375
|
if (c === 'P' || c === 'p') {
|
|
476
376
|
var _duration = core.Duration.parse(text.substring(i + 1, text.length));
|
|
477
|
-
|
|
478
377
|
return Interval.of(start, start.plus(_duration));
|
|
479
378
|
}
|
|
480
379
|
}
|
|
481
|
-
|
|
482
380
|
var _end = core.ZonedDateTime.parse(text.substring(i + 1, text.length)).toInstant();
|
|
483
|
-
|
|
484
381
|
return Interval.of(start, _end);
|
|
485
382
|
}
|
|
486
383
|
}
|
|
487
384
|
}
|
|
488
|
-
|
|
489
385
|
throw new core.DateTimeParseException('Interval cannot be parsed, no forward slash found', text, 0);
|
|
490
386
|
};
|
|
491
|
-
|
|
492
387
|
function Interval(startInclusive, endExclusive) {
|
|
493
388
|
this._start = startInclusive;
|
|
494
389
|
this._end = endExclusive;
|
|
495
390
|
}
|
|
496
|
-
|
|
497
391
|
var _proto = Interval.prototype;
|
|
498
|
-
|
|
499
392
|
_proto.start = function start() {
|
|
500
393
|
return this._start;
|
|
501
394
|
};
|
|
502
|
-
|
|
503
395
|
_proto.end = function end() {
|
|
504
396
|
return this._end;
|
|
505
397
|
};
|
|
506
|
-
|
|
507
398
|
_proto.isEmpty = function isEmpty() {
|
|
508
399
|
return this._start.equals(this._end);
|
|
509
400
|
};
|
|
510
|
-
|
|
511
401
|
_proto.isUnboundedStart = function isUnboundedStart() {
|
|
512
402
|
return this._start.equals(core.Instant.MIN);
|
|
513
403
|
};
|
|
514
|
-
|
|
515
404
|
_proto.isUnboundedEnd = function isUnboundedEnd() {
|
|
516
405
|
return this._end.equals(core.Instant.MAX);
|
|
517
406
|
};
|
|
518
|
-
|
|
519
407
|
_proto.withStart = function withStart(start) {
|
|
520
408
|
return Interval.of(start, this._end);
|
|
521
409
|
};
|
|
522
|
-
|
|
523
410
|
_proto.withEnd = function withEnd(end) {
|
|
524
411
|
return Interval.of(this._start, end);
|
|
525
412
|
};
|
|
526
|
-
|
|
527
413
|
_proto.contains = function contains(instant) {
|
|
528
414
|
requireNonNull(instant, 'instant');
|
|
529
415
|
requireInstance(instant, core.Instant, 'instant');
|
|
530
416
|
return this._start.compareTo(instant) <= 0 && (instant.compareTo(this._end) < 0 || this.isUnboundedEnd());
|
|
531
417
|
};
|
|
532
|
-
|
|
533
418
|
_proto.encloses = function encloses(other) {
|
|
534
419
|
requireNonNull(other, 'other');
|
|
535
420
|
requireInstance(other, Interval, 'other');
|
|
536
421
|
return this._start.compareTo(other.start()) <= 0 && other.end().compareTo(this._end) <= 0;
|
|
537
422
|
};
|
|
538
|
-
|
|
539
423
|
_proto.abuts = function abuts(other) {
|
|
540
424
|
requireNonNull(other, 'other');
|
|
541
425
|
requireInstance(other, Interval, 'other');
|
|
542
426
|
return !this._end.equals(other.start()) !== !this._start.equals(other.end());
|
|
543
427
|
};
|
|
544
|
-
|
|
545
428
|
_proto.isConnected = function isConnected(other) {
|
|
546
429
|
requireNonNull(other, 'other');
|
|
547
430
|
requireInstance(other, Interval, 'other');
|
|
548
431
|
return this.equals(other) || this._start.compareTo(other.end()) <= 0 && other.start().compareTo(this._end) <= 0;
|
|
549
432
|
};
|
|
550
|
-
|
|
551
433
|
_proto.overlaps = function overlaps(other) {
|
|
552
434
|
requireNonNull(other, 'other');
|
|
553
435
|
requireInstance(other, Interval, 'other');
|
|
554
436
|
return other.equals(this) || this._start.compareTo(other.end()) < 0 && other.start().compareTo(this._end) < 0;
|
|
555
437
|
};
|
|
556
|
-
|
|
557
438
|
_proto.intersection = function intersection(other) {
|
|
558
439
|
requireNonNull(other, 'other');
|
|
559
440
|
requireInstance(other, Interval, 'other');
|
|
560
|
-
|
|
561
441
|
if (this.isConnected(other) === false) {
|
|
562
442
|
throw new core.DateTimeException("Intervals do not connect: " + this + " and " + other);
|
|
563
443
|
}
|
|
564
|
-
|
|
565
444
|
var cmpStart = this._start.compareTo(other.start());
|
|
566
|
-
|
|
567
445
|
var cmpEnd = this._end.compareTo(other.end());
|
|
568
|
-
|
|
569
446
|
if (cmpStart >= 0 && cmpEnd <= 0) {
|
|
570
447
|
return this;
|
|
571
448
|
} else if (cmpStart <= 0 && cmpEnd >= 0) {
|
|
@@ -576,19 +453,14 @@
|
|
|
576
453
|
return Interval.of(newStart, newEnd);
|
|
577
454
|
}
|
|
578
455
|
};
|
|
579
|
-
|
|
580
456
|
_proto.union = function union(other) {
|
|
581
457
|
requireNonNull(other, 'other');
|
|
582
458
|
requireInstance(other, Interval, 'other');
|
|
583
|
-
|
|
584
459
|
if (this.isConnected(other) === false) {
|
|
585
460
|
throw new core.DateTimeException("Intervals do not connect: " + this + " and " + other);
|
|
586
461
|
}
|
|
587
|
-
|
|
588
462
|
var cmpStart = this._start.compareTo(other.start());
|
|
589
|
-
|
|
590
463
|
var cmpEnd = this._end.compareTo(other.end());
|
|
591
|
-
|
|
592
464
|
if (cmpStart >= 0 && cmpEnd <= 0) {
|
|
593
465
|
return other;
|
|
594
466
|
} else if (cmpStart <= 0 && cmpEnd >= 0) {
|
|
@@ -599,20 +471,15 @@
|
|
|
599
471
|
return Interval.of(newStart, newEnd);
|
|
600
472
|
}
|
|
601
473
|
};
|
|
602
|
-
|
|
603
474
|
_proto.span = function span(other) {
|
|
604
475
|
requireNonNull(other, 'other');
|
|
605
476
|
requireInstance(other, Interval, 'other');
|
|
606
|
-
|
|
607
477
|
var cmpStart = this._start.compareTo(other.start());
|
|
608
|
-
|
|
609
478
|
var cmpEnd = this._end.compareTo(other.end());
|
|
610
|
-
|
|
611
479
|
var newStart = cmpStart >= 0 ? other.start() : this._start;
|
|
612
480
|
var newEnd = cmpEnd <= 0 ? other.end() : this._end;
|
|
613
481
|
return Interval.of(newStart, newEnd);
|
|
614
482
|
};
|
|
615
|
-
|
|
616
483
|
_proto.isAfter = function isAfter(instantOrInterval) {
|
|
617
484
|
if (instantOrInterval instanceof core.Instant) {
|
|
618
485
|
return this.isAfterInstant(instantOrInterval);
|
|
@@ -620,7 +487,6 @@
|
|
|
620
487
|
return this.isAfterInterval(instantOrInterval);
|
|
621
488
|
}
|
|
622
489
|
};
|
|
623
|
-
|
|
624
490
|
_proto.isBefore = function isBefore(instantOrInterval) {
|
|
625
491
|
if (instantOrInterval instanceof core.Instant) {
|
|
626
492
|
return this.isBeforeInstant(instantOrInterval);
|
|
@@ -628,50 +494,39 @@
|
|
|
628
494
|
return this.isBeforeInterval(instantOrInterval);
|
|
629
495
|
}
|
|
630
496
|
};
|
|
631
|
-
|
|
632
497
|
_proto.isAfterInstant = function isAfterInstant(instant) {
|
|
633
498
|
return this._start.compareTo(instant) > 0;
|
|
634
499
|
};
|
|
635
|
-
|
|
636
500
|
_proto.isBeforeInstant = function isBeforeInstant(instant) {
|
|
637
501
|
return this._end.compareTo(instant) <= 0 && this._start.compareTo(instant) < 0;
|
|
638
502
|
};
|
|
639
|
-
|
|
640
503
|
_proto.isAfterInterval = function isAfterInterval(interval) {
|
|
641
504
|
return this._start.compareTo(interval.end()) >= 0 && !interval.equals(this);
|
|
642
505
|
};
|
|
643
|
-
|
|
644
506
|
_proto.isBeforeInterval = function isBeforeInterval(interval) {
|
|
645
507
|
return this._end.compareTo(interval.start()) <= 0 && !interval.equals(this);
|
|
646
508
|
};
|
|
647
|
-
|
|
648
509
|
_proto.toDuration = function toDuration() {
|
|
649
510
|
return core.Duration.between(this._start, this._end);
|
|
650
511
|
};
|
|
651
|
-
|
|
652
512
|
_proto.equals = function equals(obj) {
|
|
653
513
|
if (this === obj) {
|
|
654
514
|
return true;
|
|
655
515
|
}
|
|
656
|
-
|
|
657
516
|
if (obj instanceof Interval) {
|
|
658
517
|
return this._start.equals(obj.start()) && this._end.equals(obj.end());
|
|
659
518
|
}
|
|
660
|
-
|
|
661
519
|
return false;
|
|
662
520
|
};
|
|
663
|
-
|
|
664
521
|
_proto.hashCode = function hashCode() {
|
|
665
522
|
return this._start.hashCode() ^ this._end.hashCode();
|
|
666
523
|
};
|
|
667
|
-
|
|
668
524
|
_proto.toString = function toString() {
|
|
669
525
|
return this._start.toString() + "/" + this._end.toString();
|
|
670
526
|
};
|
|
671
|
-
|
|
672
527
|
return Interval;
|
|
673
528
|
}();
|
|
674
|
-
function _init$
|
|
529
|
+
function _init$6() {
|
|
675
530
|
Interval.ALL = Interval.of(core.Instant.MIN, core.Instant.MAX);
|
|
676
531
|
}
|
|
677
532
|
|
|
@@ -687,24 +542,18 @@
|
|
|
687
542
|
if (startInclusive instanceof core.LocalDate && endExclusiveOrPeriod instanceof core.LocalDate) {
|
|
688
543
|
return LocalDateRange._ofLocalDateLocalDate(startInclusive, endExclusiveOrPeriod);
|
|
689
544
|
}
|
|
690
|
-
|
|
691
545
|
if (startInclusive instanceof core.LocalDate && endExclusiveOrPeriod instanceof core.Period) {
|
|
692
546
|
return LocalDateRange._ofLocalDatePeriod(startInclusive, endExclusiveOrPeriod);
|
|
693
547
|
}
|
|
694
|
-
|
|
695
548
|
var messageParts = [];
|
|
696
|
-
|
|
697
549
|
if (!(startInclusive instanceof core.LocalDate)) {
|
|
698
550
|
messageParts.push("startInclusive must be an instance of LocalDate but is " + startInclusive.constructor.name);
|
|
699
551
|
}
|
|
700
|
-
|
|
701
552
|
if (!(endExclusiveOrPeriod instanceof core.LocalDate || endExclusiveOrPeriod instanceof core.Period)) {
|
|
702
553
|
messageParts.push("endExclusiveOrPeriod must be an instance of LocalDate or Period but is " + endExclusiveOrPeriod.constructor.name);
|
|
703
554
|
}
|
|
704
|
-
|
|
705
555
|
throw new core.IllegalArgumentException(messageParts.join(' and '));
|
|
706
556
|
};
|
|
707
|
-
|
|
708
557
|
LocalDateRange._ofLocalDateLocalDate = function _ofLocalDateLocalDate(startInclusive, endExclusive) {
|
|
709
558
|
requireNonNull(startInclusive, 'startInclusive');
|
|
710
559
|
requireNonNull(endExclusive, 'endExclusive');
|
|
@@ -712,188 +561,143 @@
|
|
|
712
561
|
requireInstance(endExclusive, core.LocalDate, 'endExclusive');
|
|
713
562
|
return new LocalDateRange(startInclusive, endExclusive);
|
|
714
563
|
};
|
|
715
|
-
|
|
716
564
|
LocalDateRange._ofLocalDatePeriod = function _ofLocalDatePeriod(startInclusive, period) {
|
|
717
565
|
requireNonNull(startInclusive, 'startInclusive');
|
|
718
566
|
requireNonNull(period, 'period');
|
|
719
567
|
requireInstance(startInclusive, core.LocalDate, 'startInclusive');
|
|
720
568
|
requireInstance(period, core.Period, 'period');
|
|
721
|
-
|
|
722
569
|
if (period.isNegative()) {
|
|
723
570
|
throw new core.DateTimeException('Period must not be zero or negative');
|
|
724
571
|
}
|
|
725
|
-
|
|
726
572
|
return new LocalDateRange(startInclusive, startInclusive.plus(period));
|
|
727
573
|
};
|
|
728
|
-
|
|
729
574
|
LocalDateRange.ofClosed = function ofClosed(startInclusive, endInclusive) {
|
|
730
575
|
requireNonNull(startInclusive, 'startInclusive');
|
|
731
576
|
requireNonNull(endInclusive, 'endInclusive');
|
|
732
577
|
requireInstance(startInclusive, core.LocalDate, 'startInclusive');
|
|
733
578
|
requireInstance(endInclusive, core.LocalDate, 'endInclusive');
|
|
734
|
-
|
|
735
579
|
if (endInclusive.isBefore(startInclusive)) {
|
|
736
580
|
throw new core.DateTimeException('Start date must be on or before end date');
|
|
737
581
|
}
|
|
738
|
-
|
|
739
582
|
var end = endInclusive.equals(core.LocalDate.MAX) ? core.LocalDate.MAX : endInclusive.plusDays(1);
|
|
740
583
|
return new LocalDateRange(startInclusive, end);
|
|
741
584
|
};
|
|
742
|
-
|
|
743
585
|
LocalDateRange.ofEmpty = function ofEmpty(date) {
|
|
744
586
|
requireNonNull(date, 'date');
|
|
745
587
|
requireInstance(date, core.LocalDate, 'date');
|
|
746
588
|
return new LocalDateRange(date, date);
|
|
747
589
|
};
|
|
748
|
-
|
|
749
590
|
LocalDateRange.ofUnbounded = function ofUnbounded() {
|
|
750
591
|
return LocalDateRange.ALL;
|
|
751
592
|
};
|
|
752
|
-
|
|
753
593
|
LocalDateRange.ofUnboundedStart = function ofUnboundedStart(endExclusive) {
|
|
754
594
|
requireNonNull(endExclusive, 'endExclusive');
|
|
755
595
|
requireInstance(endExclusive, core.LocalDate, 'endExclusive');
|
|
756
596
|
return LocalDateRange.of(core.LocalDate.MIN, endExclusive);
|
|
757
597
|
};
|
|
758
|
-
|
|
759
598
|
LocalDateRange.ofUnboundedEnd = function ofUnboundedEnd(startInclusive) {
|
|
760
599
|
return LocalDateRange.of(startInclusive, core.LocalDate.MAX);
|
|
761
600
|
};
|
|
762
|
-
|
|
763
601
|
LocalDateRange.parse = function parse(text) {
|
|
764
602
|
requireNonNull(text, 'text');
|
|
765
|
-
|
|
766
603
|
for (var i = 0; i < text.length; i++) {
|
|
767
604
|
if (text[i] === '/') {
|
|
768
605
|
var firstChar = text.charAt(0);
|
|
769
|
-
|
|
770
606
|
if (firstChar === 'P' || firstChar === 'p') {
|
|
771
607
|
var duration = core.Period.parse(text.slice(0, i));
|
|
772
608
|
var end = core.LocalDate.parse(text.slice(i + 1, text.length));
|
|
773
609
|
return LocalDateRange.of(end.minus(duration), end);
|
|
774
610
|
} else {
|
|
775
611
|
var start = core.LocalDate.parse(text.slice(0, i));
|
|
776
|
-
|
|
777
612
|
if (i + 1 < text.length) {
|
|
778
613
|
var c = text[i + 1];
|
|
779
|
-
|
|
780
614
|
if (c === 'P' || c === 'p') {
|
|
781
615
|
var _duration = core.Period.parse(text.slice(i + 1, text.length));
|
|
782
|
-
|
|
783
616
|
return LocalDateRange.of(start, start.plus(_duration));
|
|
784
617
|
}
|
|
785
618
|
}
|
|
786
|
-
|
|
787
619
|
var _end = core.LocalDate.parse(text.slice(i + 1, text.length));
|
|
788
|
-
|
|
789
620
|
return LocalDateRange.of(start, _end);
|
|
790
621
|
}
|
|
791
622
|
}
|
|
792
623
|
}
|
|
793
|
-
|
|
794
624
|
throw new core.DateTimeParseException('LocalDateRange cannot be parsed, no forward slash found', text, 0);
|
|
795
625
|
};
|
|
796
|
-
|
|
797
626
|
function LocalDateRange(startInclusive, endExclusive) {
|
|
798
627
|
requireNonNull(startInclusive, 'startInclusive');
|
|
799
628
|
requireNonNull(endExclusive, 'endExclusive');
|
|
800
629
|
requireInstance(startInclusive, core.LocalDate, 'startInclusive');
|
|
801
630
|
requireInstance(endExclusive, core.LocalDate, 'endExclusive');
|
|
802
|
-
|
|
803
631
|
if (endExclusive.isBefore(startInclusive)) {
|
|
804
632
|
throw new core.DateTimeException('End date must be on or after start date');
|
|
805
633
|
}
|
|
806
|
-
|
|
807
634
|
if (startInclusive.equals(MAXM1)) {
|
|
808
635
|
throw new core.DateTimeException('Range must not start at LocalDate.MAX.minusDays(1)');
|
|
809
636
|
}
|
|
810
|
-
|
|
811
637
|
if (endExclusive.equals(MINP1)) {
|
|
812
638
|
throw new core.DateTimeException('Range must not end at LocalDate.MIN.plusDays(1)');
|
|
813
639
|
}
|
|
814
|
-
|
|
815
640
|
if (endExclusive.equals(core.LocalDate.MIN) || startInclusive.equals(core.LocalDate.MAX)) {
|
|
816
641
|
throw new core.DateTimeException('Empty range must not be at LocalDate.MIN or LocalDate.MAX');
|
|
817
642
|
}
|
|
818
|
-
|
|
819
643
|
this._start = startInclusive;
|
|
820
644
|
this._end = endExclusive;
|
|
821
645
|
}
|
|
822
|
-
|
|
823
646
|
var _proto = LocalDateRange.prototype;
|
|
824
|
-
|
|
825
647
|
_proto.start = function start() {
|
|
826
648
|
return this._start;
|
|
827
649
|
};
|
|
828
|
-
|
|
829
650
|
_proto.end = function end() {
|
|
830
651
|
return this._end;
|
|
831
652
|
};
|
|
832
|
-
|
|
833
653
|
_proto.endInclusive = function endInclusive() {
|
|
834
654
|
if (this.isUnboundedEnd()) {
|
|
835
655
|
return core.LocalDate.MAX;
|
|
836
656
|
}
|
|
837
|
-
|
|
838
657
|
return this._end.minusDays(1);
|
|
839
658
|
};
|
|
840
|
-
|
|
841
659
|
_proto.isEmpty = function isEmpty() {
|
|
842
660
|
return this._start.equals(this._end);
|
|
843
661
|
};
|
|
844
|
-
|
|
845
662
|
_proto.isUnboundedStart = function isUnboundedStart() {
|
|
846
663
|
return this._start.equals(core.LocalDate.MIN);
|
|
847
664
|
};
|
|
848
|
-
|
|
849
665
|
_proto.isUnboundedEnd = function isUnboundedEnd() {
|
|
850
666
|
return this._end.equals(core.LocalDate.MAX);
|
|
851
667
|
};
|
|
852
|
-
|
|
853
668
|
_proto.withStart = function withStart(adjuster) {
|
|
854
669
|
return LocalDateRange.of(this._start.with(adjuster), this._end);
|
|
855
670
|
};
|
|
856
|
-
|
|
857
671
|
_proto.withEnd = function withEnd(adjuster) {
|
|
858
672
|
return LocalDateRange.of(this._start, this._end.with(adjuster));
|
|
859
673
|
};
|
|
860
|
-
|
|
861
674
|
_proto.contains = function contains(date) {
|
|
862
675
|
requireNonNull(date, 'date');
|
|
863
676
|
return this._start.compareTo(date) <= 0 && (date.compareTo(this._end) < 0 || this.isUnboundedEnd());
|
|
864
677
|
};
|
|
865
|
-
|
|
866
678
|
_proto.encloses = function encloses(other) {
|
|
867
679
|
requireNonNull(other, 'other');
|
|
868
680
|
return this._start.compareTo(other._start) <= 0 && other._end.compareTo(this._end) <= 0;
|
|
869
681
|
};
|
|
870
|
-
|
|
871
682
|
_proto.abuts = function abuts(other) {
|
|
872
683
|
requireNonNull(other, 'other');
|
|
873
684
|
return this._end.equals(other._start) !== this._start.equals(other._end);
|
|
874
685
|
};
|
|
875
|
-
|
|
876
686
|
_proto.isConnected = function isConnected(other) {
|
|
877
687
|
requireNonNull(other, 'other');
|
|
878
688
|
return this.equals(other) || this._start.compareTo(other._end) <= 0 && other._start.compareTo(this._end) <= 0;
|
|
879
689
|
};
|
|
880
|
-
|
|
881
690
|
_proto.overlaps = function overlaps(other) {
|
|
882
691
|
requireNonNull(other, 'other');
|
|
883
692
|
return other.equals(this) || this._start.compareTo(other._end) < 0 && other._start.compareTo(this._end) < 0;
|
|
884
693
|
};
|
|
885
|
-
|
|
886
694
|
_proto.intersection = function intersection(other) {
|
|
887
695
|
requireNonNull(other, 'other');
|
|
888
|
-
|
|
889
696
|
if (this.isConnected(other) === false) {
|
|
890
697
|
throw new core.DateTimeException("Ranges do not connect: " + this + " and " + other);
|
|
891
698
|
}
|
|
892
|
-
|
|
893
699
|
var cmpStart = this._start.compareTo(other._start);
|
|
894
|
-
|
|
895
700
|
var cmpEnd = this._end.compareTo(other._end);
|
|
896
|
-
|
|
897
701
|
if (cmpStart >= 0 && cmpEnd <= 0) {
|
|
898
702
|
return this;
|
|
899
703
|
} else if (cmpStart <= 0 && cmpEnd >= 0) {
|
|
@@ -904,18 +708,13 @@
|
|
|
904
708
|
return LocalDateRange.of(newStart, newEnd);
|
|
905
709
|
}
|
|
906
710
|
};
|
|
907
|
-
|
|
908
711
|
_proto.union = function union(other) {
|
|
909
712
|
requireNonNull(other, 'other');
|
|
910
|
-
|
|
911
713
|
if (this.isConnected(other) === false) {
|
|
912
714
|
throw new core.DateTimeException("Ranges do not connect: " + this + " and " + other);
|
|
913
715
|
}
|
|
914
|
-
|
|
915
716
|
var cmpStart = this._start.compareTo(other._start);
|
|
916
|
-
|
|
917
717
|
var cmpEnd = this._end.compareTo(other._end);
|
|
918
|
-
|
|
919
718
|
if (cmpStart >= 0 && cmpEnd <= 0) {
|
|
920
719
|
return other;
|
|
921
720
|
} else if (cmpStart <= 0 && cmpEnd >= 0) {
|
|
@@ -926,107 +725,82 @@
|
|
|
926
725
|
return LocalDateRange.of(newStart, newEnd);
|
|
927
726
|
}
|
|
928
727
|
};
|
|
929
|
-
|
|
930
728
|
_proto.span = function span(other) {
|
|
931
729
|
requireNonNull(other, 'other');
|
|
932
|
-
|
|
933
730
|
var cmpStart = this._start.compareTo(other._start);
|
|
934
|
-
|
|
935
731
|
var cmpEnd = this._end.compareTo(other._end);
|
|
936
|
-
|
|
937
732
|
var newStart = cmpStart >= 0 ? other._start : this._start;
|
|
938
733
|
var newEnd = cmpEnd <= 0 ? other._end : this._end;
|
|
939
734
|
return LocalDateRange.of(newStart, newEnd);
|
|
940
735
|
};
|
|
941
|
-
|
|
942
736
|
_proto.isAfter = function isAfter(localDateOrLocalDateRange) {
|
|
943
737
|
if (localDateOrLocalDateRange instanceof core.LocalDate) {
|
|
944
738
|
return this._isAfterLocalDate(localDateOrLocalDateRange);
|
|
945
739
|
}
|
|
946
|
-
|
|
947
740
|
if (localDateOrLocalDateRange instanceof LocalDateRange) {
|
|
948
741
|
return this._isAfterLocalDateRange(localDateOrLocalDateRange);
|
|
949
742
|
}
|
|
950
|
-
|
|
951
743
|
throw new core.IllegalArgumentException("localDateOrLocalDateRange must be an instance of LocalDate or LocalDateRange but is " + localDateOrLocalDateRange.constructor.name);
|
|
952
744
|
};
|
|
953
|
-
|
|
954
745
|
_proto.isBefore = function isBefore(localDateOrLocalDateRange) {
|
|
955
746
|
if (localDateOrLocalDateRange instanceof core.LocalDate) {
|
|
956
747
|
return this._isBeforeLocalDate(localDateOrLocalDateRange);
|
|
957
748
|
}
|
|
958
|
-
|
|
959
749
|
if (localDateOrLocalDateRange instanceof LocalDateRange) {
|
|
960
750
|
return this._isBeforeLocalDateRange(localDateOrLocalDateRange);
|
|
961
751
|
}
|
|
962
|
-
|
|
963
752
|
throw new core.IllegalArgumentException("localDateOrLocalDateRange must be an instance of LocalDate or LocalDateRange but is " + localDateOrLocalDateRange.constructor.name);
|
|
964
753
|
};
|
|
965
|
-
|
|
966
754
|
_proto._isAfterLocalDate = function _isAfterLocalDate(date) {
|
|
967
755
|
return this._start.compareTo(date) > 0;
|
|
968
756
|
};
|
|
969
|
-
|
|
970
757
|
_proto._isBeforeLocalDate = function _isBeforeLocalDate(date) {
|
|
971
758
|
return this._end.compareTo(date) <= 0 && this._start.compareTo(date) < 0;
|
|
972
759
|
};
|
|
973
|
-
|
|
974
760
|
_proto._isAfterLocalDateRange = function _isAfterLocalDateRange(other) {
|
|
975
761
|
return this._start.compareTo(other._end) >= 0 && !other.equals(this);
|
|
976
762
|
};
|
|
977
|
-
|
|
978
763
|
_proto._isBeforeLocalDateRange = function _isBeforeLocalDateRange(range) {
|
|
979
764
|
return this._end.compareTo(range._start) <= 0 && !range.equals(this);
|
|
980
765
|
};
|
|
981
|
-
|
|
982
766
|
_proto.lengthInDays = function lengthInDays() {
|
|
983
767
|
if (this.isUnboundedStart() || this.isUnboundedEnd()) {
|
|
984
768
|
return Number.POSITIVE_INFINITY;
|
|
985
769
|
}
|
|
986
|
-
|
|
987
770
|
return this._end.toEpochDay() - this._start.toEpochDay();
|
|
988
771
|
};
|
|
989
|
-
|
|
990
772
|
_proto.toPeriod = function toPeriod() {
|
|
991
773
|
if (this.isUnboundedStart() || this.isUnboundedEnd()) {
|
|
992
774
|
throw new core.ArithmeticException('Unbounded range cannot be converted to a Period');
|
|
993
775
|
}
|
|
994
|
-
|
|
995
776
|
return core.Period.between(this._start, this._end);
|
|
996
777
|
};
|
|
997
|
-
|
|
998
778
|
_proto.equals = function equals(obj) {
|
|
999
779
|
if (this === obj) {
|
|
1000
780
|
return true;
|
|
1001
781
|
}
|
|
1002
|
-
|
|
1003
782
|
if (obj instanceof LocalDateRange) {
|
|
1004
783
|
var other = obj;
|
|
1005
784
|
return this._start.equals(other._start) && this._end.equals(other._end);
|
|
1006
785
|
}
|
|
1007
|
-
|
|
1008
786
|
return false;
|
|
1009
787
|
};
|
|
1010
|
-
|
|
1011
788
|
_proto.hashCode = function hashCode() {
|
|
1012
789
|
return this._start.hashCode() ^ this._end.hashCode();
|
|
1013
790
|
};
|
|
1014
|
-
|
|
1015
791
|
_proto.toString = function toString() {
|
|
1016
792
|
return this._start.toString() + "/" + this._end.toString();
|
|
1017
793
|
};
|
|
1018
|
-
|
|
1019
794
|
return LocalDateRange;
|
|
1020
795
|
}();
|
|
1021
|
-
function _init$
|
|
796
|
+
function _init$5() {
|
|
1022
797
|
LocalDateRange.ALL = new LocalDateRange(core.LocalDate.MIN, core.LocalDate.MAX);
|
|
1023
798
|
}
|
|
1024
799
|
|
|
1025
|
-
var MathUtil$
|
|
800
|
+
var MathUtil$4 = core._.MathUtil;
|
|
1026
801
|
var SECONDS_PER_DAY = 86400;
|
|
1027
802
|
var OffsetDate = function (_Temporal) {
|
|
1028
803
|
_inheritsLoose(OffsetDate, _Temporal);
|
|
1029
|
-
|
|
1030
804
|
OffsetDate.now = function now(zoneIdOrClock) {
|
|
1031
805
|
if (arguments.length === 0) {
|
|
1032
806
|
return OffsetDate._now0();
|
|
@@ -1036,61 +810,49 @@
|
|
|
1036
810
|
return OffsetDate._nowClock(zoneIdOrClock);
|
|
1037
811
|
}
|
|
1038
812
|
};
|
|
1039
|
-
|
|
1040
813
|
OffsetDate._now0 = function _now0() {
|
|
1041
814
|
return OffsetDate.now(core.Clock.systemDefaultZone());
|
|
1042
815
|
};
|
|
1043
|
-
|
|
1044
816
|
OffsetDate._nowZoneId = function _nowZoneId(zone) {
|
|
1045
817
|
return OffsetDate.now(core.Clock.system(zone));
|
|
1046
818
|
};
|
|
1047
|
-
|
|
1048
819
|
OffsetDate._nowClock = function _nowClock(clock) {
|
|
1049
820
|
requireNonNull(clock, 'clock');
|
|
1050
821
|
var now = clock.instant();
|
|
1051
822
|
return OffsetDate.ofInstant(now, clock.zone().rules().offset(now));
|
|
1052
823
|
};
|
|
1053
|
-
|
|
1054
824
|
OffsetDate.of = function of() {
|
|
1055
825
|
switch (arguments.length) {
|
|
1056
826
|
case 2:
|
|
1057
827
|
return OffsetDate._ofLocalDateZoneOffset.apply(OffsetDate, arguments);
|
|
1058
|
-
|
|
1059
828
|
case 4:
|
|
1060
829
|
return OffsetDate._ofIntIntIntZoneOffset.apply(OffsetDate, arguments);
|
|
1061
|
-
|
|
1062
830
|
default:
|
|
1063
831
|
throw new core.IllegalArgumentException('Illegal number of arguments');
|
|
1064
832
|
}
|
|
1065
833
|
};
|
|
1066
|
-
|
|
1067
834
|
OffsetDate._ofLocalDateZoneOffset = function _ofLocalDateZoneOffset(date, offset) {
|
|
1068
835
|
return new OffsetDate(date, offset);
|
|
1069
836
|
};
|
|
1070
|
-
|
|
1071
837
|
OffsetDate._ofIntIntIntZoneOffset = function _ofIntIntIntZoneOffset(year, month, dayOfMonth, offset) {
|
|
1072
838
|
var d = core.LocalDate.of(year, month, dayOfMonth);
|
|
1073
839
|
return new OffsetDate(d, offset);
|
|
1074
840
|
};
|
|
1075
|
-
|
|
1076
841
|
OffsetDate.ofInstant = function ofInstant(instant, zone) {
|
|
1077
842
|
requireNonNull(instant, 'instant');
|
|
1078
843
|
requireNonNull(zone, 'zone');
|
|
1079
844
|
var rules = zone.rules();
|
|
1080
845
|
var offset = rules.offset(instant);
|
|
1081
846
|
var epochSec = instant.epochSecond() + offset.totalSeconds();
|
|
1082
|
-
var epochDay = MathUtil$
|
|
847
|
+
var epochDay = MathUtil$4.floorDiv(epochSec, SECONDS_PER_DAY);
|
|
1083
848
|
var date = core.LocalDate.ofEpochDay(epochDay);
|
|
1084
849
|
return new OffsetDate(date, offset);
|
|
1085
850
|
};
|
|
1086
|
-
|
|
1087
851
|
OffsetDate.from = function from(temporal) {
|
|
1088
852
|
if (temporal instanceof OffsetDate) {
|
|
1089
853
|
return temporal;
|
|
1090
854
|
}
|
|
1091
|
-
|
|
1092
855
|
requireNonNull(temporal, 'temporal');
|
|
1093
|
-
|
|
1094
856
|
try {
|
|
1095
857
|
var date = core.LocalDate.from(temporal);
|
|
1096
858
|
var offset = core.ZoneOffset.from(temporal);
|
|
@@ -1099,140 +861,106 @@
|
|
|
1099
861
|
throw new core.DateTimeException("Unable to obtain OffsetDate from TemporalAccessor: " + temporal.constructor.name, ex);
|
|
1100
862
|
}
|
|
1101
863
|
};
|
|
1102
|
-
|
|
1103
864
|
OffsetDate.parse = function parse(text, formatter) {
|
|
1104
865
|
if (formatter === void 0) {
|
|
1105
866
|
formatter = core.DateTimeFormatter.ISO_OFFSET_DATE;
|
|
1106
867
|
}
|
|
1107
|
-
|
|
1108
868
|
requireNonNull(formatter, 'formatter');
|
|
1109
869
|
return formatter.parse(text, OffsetDate.FROM);
|
|
1110
870
|
};
|
|
1111
|
-
|
|
1112
871
|
function OffsetDate(date, offset) {
|
|
1113
872
|
var _this;
|
|
1114
|
-
|
|
1115
873
|
_this = _Temporal.call(this) || this;
|
|
1116
874
|
_this._date = requireNonNull(date, 'date');
|
|
1117
875
|
_this._offset = requireNonNull(offset, 'offset');
|
|
1118
876
|
return _this;
|
|
1119
877
|
}
|
|
1120
|
-
|
|
1121
878
|
var _proto = OffsetDate.prototype;
|
|
1122
|
-
|
|
1123
879
|
_proto._with = function _with(date, offset) {
|
|
1124
880
|
if (this._date === date && this._offset.equals(offset)) {
|
|
1125
881
|
return this;
|
|
1126
882
|
}
|
|
1127
|
-
|
|
1128
883
|
return new OffsetDate(date, offset);
|
|
1129
884
|
};
|
|
1130
|
-
|
|
1131
885
|
_proto.isSupported = function isSupported(fieldOrUnit) {
|
|
1132
886
|
if (fieldOrUnit instanceof core.TemporalField) {
|
|
1133
887
|
return this._isSupportedField(fieldOrUnit);
|
|
1134
888
|
}
|
|
1135
|
-
|
|
1136
889
|
if (fieldOrUnit instanceof core.TemporalUnit) {
|
|
1137
890
|
return this._isSupportedUnit(fieldOrUnit);
|
|
1138
891
|
}
|
|
1139
|
-
|
|
1140
892
|
if (fieldOrUnit == null) {
|
|
1141
893
|
return false;
|
|
1142
894
|
}
|
|
1143
|
-
|
|
1144
895
|
throw new core.IllegalArgumentException("fieldOrUnit must be an instance of TemporalField or TemporalUnit, but is " + fieldOrUnit.constructor.name);
|
|
1145
896
|
};
|
|
1146
|
-
|
|
1147
897
|
_proto._isSupportedField = function _isSupportedField(field) {
|
|
1148
898
|
if (field instanceof core.ChronoField) {
|
|
1149
899
|
return field.isDateBased() || field === core.ChronoField.OFFSET_SECONDS;
|
|
1150
900
|
}
|
|
1151
|
-
|
|
1152
901
|
return field != null && field.isSupportedBy(this);
|
|
1153
902
|
};
|
|
1154
|
-
|
|
1155
903
|
_proto._isSupportedUnit = function _isSupportedUnit(unit) {
|
|
1156
904
|
if (unit instanceof core.ChronoUnit) {
|
|
1157
905
|
return unit.isDateBased();
|
|
1158
906
|
}
|
|
1159
|
-
|
|
1160
907
|
return unit != null && unit.isSupportedBy(this);
|
|
1161
908
|
};
|
|
1162
|
-
|
|
1163
909
|
_proto.range = function range(field) {
|
|
1164
910
|
requireNonNull(field, 'field');
|
|
1165
911
|
requireInstance(field, core.TemporalField, 'field');
|
|
1166
|
-
|
|
1167
912
|
if (field instanceof core.ChronoField) {
|
|
1168
913
|
if (field === core.ChronoField.OFFSET_SECONDS) {
|
|
1169
914
|
return field.range();
|
|
1170
915
|
}
|
|
1171
|
-
|
|
1172
916
|
return this._date.range(field);
|
|
1173
917
|
}
|
|
1174
|
-
|
|
1175
918
|
return field.rangeRefinedBy(this);
|
|
1176
919
|
};
|
|
1177
|
-
|
|
1178
920
|
_proto.get = function get(field) {
|
|
1179
921
|
requireNonNull(field, 'field');
|
|
1180
922
|
requireInstance(field, core.TemporalField, 'field');
|
|
1181
923
|
return this.range(field).checkValidIntValue(this.getLong(field), field);
|
|
1182
924
|
};
|
|
1183
|
-
|
|
1184
925
|
_proto.getLong = function getLong(field) {
|
|
1185
926
|
requireNonNull(field, 'field');
|
|
1186
927
|
requireInstance(field, core.TemporalField, 'field');
|
|
1187
|
-
|
|
1188
928
|
if (field instanceof core.ChronoField) {
|
|
1189
929
|
if (field === core.ChronoField.OFFSET_SECONDS) {
|
|
1190
930
|
return this.offset().totalSeconds();
|
|
1191
931
|
}
|
|
1192
|
-
|
|
1193
932
|
return this._date.getLong(field);
|
|
1194
933
|
}
|
|
1195
|
-
|
|
1196
934
|
return field.getFrom(this);
|
|
1197
935
|
};
|
|
1198
|
-
|
|
1199
936
|
_proto.offset = function offset() {
|
|
1200
937
|
return this._offset;
|
|
1201
938
|
};
|
|
1202
|
-
|
|
1203
939
|
_proto.withOffsetSameLocal = function withOffsetSameLocal(offset) {
|
|
1204
940
|
requireNonNull(offset, 'offset');
|
|
1205
941
|
return this._with(this._date, offset);
|
|
1206
942
|
};
|
|
1207
|
-
|
|
1208
943
|
_proto.toLocalDate = function toLocalDate() {
|
|
1209
944
|
return this._date;
|
|
1210
945
|
};
|
|
1211
|
-
|
|
1212
946
|
_proto.year = function year() {
|
|
1213
947
|
return this._date.year();
|
|
1214
948
|
};
|
|
1215
|
-
|
|
1216
949
|
_proto.monthValue = function monthValue() {
|
|
1217
950
|
return this._date.monthValue();
|
|
1218
951
|
};
|
|
1219
|
-
|
|
1220
952
|
_proto.month = function month() {
|
|
1221
953
|
return this._date.month();
|
|
1222
954
|
};
|
|
1223
|
-
|
|
1224
955
|
_proto.dayOfMonth = function dayOfMonth() {
|
|
1225
956
|
return this._date.dayOfMonth();
|
|
1226
957
|
};
|
|
1227
|
-
|
|
1228
958
|
_proto.dayOfYear = function dayOfYear() {
|
|
1229
959
|
return this._date.dayOfYear();
|
|
1230
960
|
};
|
|
1231
|
-
|
|
1232
961
|
_proto.dayOfWeek = function dayOfWeek() {
|
|
1233
962
|
return this._date.dayOfWeek();
|
|
1234
963
|
};
|
|
1235
|
-
|
|
1236
964
|
_proto._withAdjuster = function _withAdjuster(adjuster) {
|
|
1237
965
|
if (adjuster instanceof core.LocalDate) {
|
|
1238
966
|
return this._with(adjuster, this._offset);
|
|
@@ -1241,86 +969,65 @@
|
|
|
1241
969
|
} else if (adjuster instanceof OffsetDate) {
|
|
1242
970
|
return adjuster;
|
|
1243
971
|
}
|
|
1244
|
-
|
|
1245
972
|
return _Temporal.prototype._withAdjuster.call(this, adjuster);
|
|
1246
973
|
};
|
|
1247
|
-
|
|
1248
974
|
_proto._withField = function _withField(field, newValue) {
|
|
1249
975
|
requireNonNull(field, 'field');
|
|
1250
976
|
requireInstance(field, core.TemporalField, 'field');
|
|
1251
|
-
|
|
1252
977
|
if (field instanceof core.ChronoField) {
|
|
1253
978
|
if (field === core.ChronoField.OFFSET_SECONDS) {
|
|
1254
979
|
var f = field;
|
|
1255
980
|
return this._with(this._date, core.ZoneOffset.ofTotalSeconds(f.checkValidIntValue(newValue)));
|
|
1256
981
|
}
|
|
1257
|
-
|
|
1258
982
|
return this._with(this._date.with(field, newValue), this._offset);
|
|
1259
983
|
}
|
|
1260
|
-
|
|
1261
984
|
return field.adjustInto(this, newValue);
|
|
1262
985
|
};
|
|
1263
|
-
|
|
1264
986
|
_proto.withYear = function withYear(year) {
|
|
1265
987
|
return this._with(this._date.withYear(year), this._offset);
|
|
1266
988
|
};
|
|
1267
|
-
|
|
1268
989
|
_proto.withMonth = function withMonth(month) {
|
|
1269
990
|
return this._with(this._date.withMonth(month), this._offset);
|
|
1270
991
|
};
|
|
1271
|
-
|
|
1272
992
|
_proto.withDayOfMonth = function withDayOfMonth(dayOfMonth) {
|
|
1273
993
|
return this._with(this._date.withDayOfMonth(dayOfMonth), this._offset);
|
|
1274
994
|
};
|
|
1275
|
-
|
|
1276
995
|
_proto.withDayOfYear = function withDayOfYear(dayOfYear) {
|
|
1277
996
|
return this._with(this._date.withDayOfYear(dayOfYear), this._offset);
|
|
1278
997
|
};
|
|
1279
|
-
|
|
1280
998
|
_proto._plusUnit = function _plusUnit(amountToAdd, unit) {
|
|
1281
999
|
if (unit instanceof core.ChronoUnit) {
|
|
1282
1000
|
return this._with(this._date.plus(amountToAdd, unit), this._offset);
|
|
1283
1001
|
}
|
|
1284
|
-
|
|
1285
1002
|
return unit.addTo(this, amountToAdd);
|
|
1286
1003
|
};
|
|
1287
|
-
|
|
1288
1004
|
_proto.plusYears = function plusYears(years) {
|
|
1289
1005
|
return this._with(this._date.plusYears(years), this._offset);
|
|
1290
1006
|
};
|
|
1291
|
-
|
|
1292
1007
|
_proto.plusMonths = function plusMonths(months) {
|
|
1293
1008
|
return this._with(this._date.plusMonths(months), this._offset);
|
|
1294
1009
|
};
|
|
1295
|
-
|
|
1296
1010
|
_proto.plusWeeks = function plusWeeks(weeks) {
|
|
1297
1011
|
return this._with(this._date.plusWeeks(weeks), this._offset);
|
|
1298
1012
|
};
|
|
1299
|
-
|
|
1300
1013
|
_proto.plusDays = function plusDays(days) {
|
|
1301
1014
|
return this._with(this._date.plusDays(days), this._offset);
|
|
1302
1015
|
};
|
|
1303
|
-
|
|
1304
1016
|
_proto.minusYears = function minusYears(years) {
|
|
1305
1017
|
return this._with(this._date.minusYears(years), this._offset);
|
|
1306
1018
|
};
|
|
1307
|
-
|
|
1308
1019
|
_proto.minusMonths = function minusMonths(months) {
|
|
1309
1020
|
return this._with(this._date.minusMonths(months), this._offset);
|
|
1310
1021
|
};
|
|
1311
|
-
|
|
1312
1022
|
_proto.minusWeeks = function minusWeeks(weeks) {
|
|
1313
1023
|
return this._with(this._date.minusWeeks(weeks), this._offset);
|
|
1314
1024
|
};
|
|
1315
|
-
|
|
1316
1025
|
_proto.minusDays = function minusDays(days) {
|
|
1317
1026
|
return this._with(this._date.minusDays(days), this._offset);
|
|
1318
1027
|
};
|
|
1319
|
-
|
|
1320
1028
|
_proto.query = function query(_query) {
|
|
1321
1029
|
requireNonNull(_query, 'query');
|
|
1322
1030
|
requireInstance(_query, core.TemporalQuery, 'query');
|
|
1323
|
-
|
|
1324
1031
|
if (_query === core.TemporalQueries.chronology()) {
|
|
1325
1032
|
return core.IsoChronology.INSTANCE;
|
|
1326
1033
|
} else if (_query === core.TemporalQueries.precision()) {
|
|
@@ -1328,349 +1035,268 @@
|
|
|
1328
1035
|
} else if (_query === core.TemporalQueries.offset() || _query === core.TemporalQueries.zone()) {
|
|
1329
1036
|
return this.offset();
|
|
1330
1037
|
}
|
|
1331
|
-
|
|
1332
1038
|
return _Temporal.prototype.query.call(this, _query);
|
|
1333
1039
|
};
|
|
1334
|
-
|
|
1335
1040
|
_proto.adjustInto = function adjustInto(temporal) {
|
|
1336
1041
|
return temporal.with(core.ChronoField.OFFSET_SECONDS, this.offset().totalSeconds()).with(core.ChronoField.EPOCH_DAY, this.toLocalDate().toEpochDay());
|
|
1337
1042
|
};
|
|
1338
|
-
|
|
1339
1043
|
_proto.until = function until(endExclusive, unit) {
|
|
1340
1044
|
var end = OffsetDate.from(endExclusive);
|
|
1341
|
-
|
|
1342
1045
|
if (unit instanceof core.ChronoUnit) {
|
|
1343
1046
|
var offsetDiff = end._offset.totalSeconds() - this._offset.totalSeconds();
|
|
1344
|
-
|
|
1345
|
-
var endLocal = end._date.plusDays(MathUtil$3.intDiv(-offsetDiff, SECONDS_PER_DAY));
|
|
1346
|
-
|
|
1047
|
+
var endLocal = end._date.plusDays(MathUtil$4.intDiv(-offsetDiff, SECONDS_PER_DAY));
|
|
1347
1048
|
return this._date.until(endLocal, unit);
|
|
1348
1049
|
}
|
|
1349
|
-
|
|
1350
1050
|
return unit.between(this, end);
|
|
1351
1051
|
};
|
|
1352
|
-
|
|
1353
1052
|
_proto.format = function format(formatter) {
|
|
1354
1053
|
requireNonNull(formatter, 'formatter');
|
|
1355
1054
|
return formatter.format(this);
|
|
1356
1055
|
};
|
|
1357
|
-
|
|
1358
1056
|
_proto.atTime = function atTime(time) {
|
|
1359
1057
|
return core.OffsetDateTime.of(this._date, time, this._offset);
|
|
1360
1058
|
};
|
|
1361
|
-
|
|
1362
1059
|
_proto._toEpochSecond = function _toEpochSecond() {
|
|
1363
1060
|
var epochDay = this._date.toEpochDay();
|
|
1364
|
-
|
|
1365
1061
|
var secs = epochDay * SECONDS_PER_DAY;
|
|
1366
1062
|
return secs - this._offset.totalSeconds();
|
|
1367
1063
|
};
|
|
1368
|
-
|
|
1369
1064
|
_proto.toEpochSecond = function toEpochSecond(time) {
|
|
1370
1065
|
requireNonNull(time, 'time');
|
|
1371
1066
|
return this._toEpochSecond() + time.toSecondOfDay();
|
|
1372
1067
|
};
|
|
1373
|
-
|
|
1374
1068
|
_proto.compareTo = function compareTo(other) {
|
|
1375
1069
|
requireNonNull(other, 'other');
|
|
1376
1070
|
requireInstance(other, OffsetDate, 'other');
|
|
1377
|
-
|
|
1378
1071
|
if (this._offset.equals(other._offset)) {
|
|
1379
1072
|
return this._date.compareTo(other._date);
|
|
1380
1073
|
}
|
|
1381
|
-
|
|
1382
1074
|
var compare = this._toEpochSecond() - other._toEpochSecond();
|
|
1383
|
-
|
|
1384
1075
|
if (compare === 0) {
|
|
1385
1076
|
compare = this._date.compareTo(other._date);
|
|
1386
1077
|
}
|
|
1387
|
-
|
|
1388
1078
|
return compare;
|
|
1389
1079
|
};
|
|
1390
|
-
|
|
1391
1080
|
_proto.isAfter = function isAfter(other) {
|
|
1392
1081
|
requireNonNull(other, 'other');
|
|
1393
1082
|
requireInstance(other, OffsetDate, 'other');
|
|
1394
1083
|
return this._toEpochSecond() > other._toEpochSecond();
|
|
1395
1084
|
};
|
|
1396
|
-
|
|
1397
1085
|
_proto.isBefore = function isBefore(other) {
|
|
1398
1086
|
requireNonNull(other, 'other');
|
|
1399
1087
|
requireInstance(other, OffsetDate, 'other');
|
|
1400
1088
|
return this._toEpochSecond() < other._toEpochSecond();
|
|
1401
1089
|
};
|
|
1402
|
-
|
|
1403
1090
|
_proto.isEqual = function isEqual(other) {
|
|
1404
1091
|
requireNonNull(other, 'other');
|
|
1405
1092
|
requireInstance(other, OffsetDate, 'other');
|
|
1406
1093
|
return this._toEpochSecond() === other._toEpochSecond();
|
|
1407
1094
|
};
|
|
1408
|
-
|
|
1409
1095
|
_proto.equals = function equals(obj) {
|
|
1410
1096
|
if (this === obj) {
|
|
1411
1097
|
return true;
|
|
1412
1098
|
}
|
|
1413
|
-
|
|
1414
1099
|
if (obj instanceof OffsetDate) {
|
|
1415
1100
|
var other = obj;
|
|
1416
1101
|
return this._date.equals(other._date) && this._offset.equals(other._offset);
|
|
1417
1102
|
}
|
|
1418
|
-
|
|
1419
1103
|
return false;
|
|
1420
1104
|
};
|
|
1421
|
-
|
|
1422
1105
|
_proto.hashCode = function hashCode() {
|
|
1423
1106
|
return this._date.hashCode() ^ this._offset.hashCode();
|
|
1424
1107
|
};
|
|
1425
|
-
|
|
1426
1108
|
_proto.toString = function toString() {
|
|
1427
1109
|
return this._date.toString() + this._offset.toString();
|
|
1428
1110
|
};
|
|
1429
|
-
|
|
1430
1111
|
return OffsetDate;
|
|
1431
1112
|
}(core.Temporal);
|
|
1432
|
-
function _init$
|
|
1113
|
+
function _init$4() {
|
|
1433
1114
|
OffsetDate.MIN = OffsetDate.of(core.LocalDate.MIN, core.ZoneOffset.MAX);
|
|
1434
1115
|
OffsetDate.MAX = OffsetDate.of(core.LocalDate.MAX, core.ZoneOffset.MIN);
|
|
1435
1116
|
OffsetDate.FROM = createTemporalQuery$3('OffsetDate.FROM', function (temporal) {
|
|
1436
1117
|
return OffsetDate.from(temporal);
|
|
1437
1118
|
});
|
|
1438
1119
|
}
|
|
1439
|
-
|
|
1440
1120
|
function createTemporalQuery$3(name, queryFromFunction) {
|
|
1441
1121
|
var ExtendedTemporalQuery = function (_TemporalQuery) {
|
|
1442
1122
|
_inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
|
|
1443
|
-
|
|
1444
1123
|
function ExtendedTemporalQuery() {
|
|
1445
1124
|
return _TemporalQuery.apply(this, arguments) || this;
|
|
1446
1125
|
}
|
|
1447
|
-
|
|
1448
1126
|
return ExtendedTemporalQuery;
|
|
1449
1127
|
}(core.TemporalQuery);
|
|
1450
|
-
|
|
1451
1128
|
ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
|
|
1452
1129
|
return new ExtendedTemporalQuery(name);
|
|
1453
1130
|
}
|
|
1454
1131
|
|
|
1455
|
-
var MathUtil$
|
|
1132
|
+
var MathUtil$3 = core._.MathUtil;
|
|
1456
1133
|
var Quarter = function (_TemporalAccessor) {
|
|
1457
1134
|
_inheritsLoose(Quarter, _TemporalAccessor);
|
|
1458
|
-
|
|
1459
1135
|
Quarter.valueOf = function valueOf(name) {
|
|
1460
1136
|
requireNonNull(name, 'name');
|
|
1461
|
-
|
|
1462
1137
|
switch (name) {
|
|
1463
1138
|
case 'Q1':
|
|
1464
1139
|
return Quarter.Q1;
|
|
1465
|
-
|
|
1466
1140
|
case 'Q2':
|
|
1467
1141
|
return Quarter.Q2;
|
|
1468
|
-
|
|
1469
1142
|
case 'Q3':
|
|
1470
1143
|
return Quarter.Q3;
|
|
1471
|
-
|
|
1472
1144
|
case 'Q4':
|
|
1473
1145
|
return Quarter.Q4;
|
|
1474
1146
|
}
|
|
1475
|
-
|
|
1476
1147
|
throw new core.IllegalArgumentException("No enum constant Quarter." + name);
|
|
1477
1148
|
};
|
|
1478
|
-
|
|
1479
1149
|
Quarter.values = function values() {
|
|
1480
1150
|
return QUARTERS.slice();
|
|
1481
1151
|
};
|
|
1482
|
-
|
|
1483
1152
|
Quarter.of = function of(quarterOfYear) {
|
|
1484
1153
|
requireNonNull(quarterOfYear, 'quarterOfYear');
|
|
1485
|
-
|
|
1486
1154
|
switch (quarterOfYear) {
|
|
1487
1155
|
case 1:
|
|
1488
1156
|
return Quarter.Q1;
|
|
1489
|
-
|
|
1490
1157
|
case 2:
|
|
1491
1158
|
return Quarter.Q2;
|
|
1492
|
-
|
|
1493
1159
|
case 3:
|
|
1494
1160
|
return Quarter.Q3;
|
|
1495
|
-
|
|
1496
1161
|
case 4:
|
|
1497
1162
|
return Quarter.Q4;
|
|
1498
|
-
|
|
1499
1163
|
default:
|
|
1500
1164
|
throw new core.DateTimeException("Invalid value for Quarter: " + quarterOfYear);
|
|
1501
1165
|
}
|
|
1502
1166
|
};
|
|
1503
|
-
|
|
1504
1167
|
Quarter.ofMonth = function ofMonth(monthOfYear) {
|
|
1505
1168
|
requireNonNull(monthOfYear, 'monthOfYear');
|
|
1506
1169
|
core.ChronoField.MONTH_OF_YEAR.range().checkValidValue(monthOfYear, core.ChronoField.MONTH_OF_YEAR);
|
|
1507
|
-
return Quarter.of(MathUtil$
|
|
1170
|
+
return Quarter.of(MathUtil$3.intDiv(monthOfYear - 1, 3) + 1);
|
|
1508
1171
|
};
|
|
1509
|
-
|
|
1510
1172
|
Quarter.from = function from(temporal) {
|
|
1511
1173
|
if (temporal instanceof Quarter) {
|
|
1512
1174
|
return temporal;
|
|
1513
1175
|
} else if (temporal instanceof core.Month) {
|
|
1514
1176
|
var month = temporal;
|
|
1515
|
-
return Quarter.of(MathUtil$
|
|
1177
|
+
return Quarter.of(MathUtil$3.intDiv(month.ordinal(), 3) + 1);
|
|
1516
1178
|
}
|
|
1517
|
-
|
|
1518
1179
|
try {
|
|
1519
|
-
var qoy = MathUtil$
|
|
1180
|
+
var qoy = MathUtil$3.safeToInt(temporal.getLong(core.IsoFields.QUARTER_OF_YEAR));
|
|
1520
1181
|
return Quarter.of(qoy);
|
|
1521
1182
|
} catch (ex) {
|
|
1522
1183
|
throw new core.DateTimeException("Unable to obtain Quarter from TemporalAccessor: " + temporal + " of type " + temporal.constructor.name, ex);
|
|
1523
1184
|
}
|
|
1524
1185
|
};
|
|
1525
|
-
|
|
1526
1186
|
function Quarter(value, name) {
|
|
1527
1187
|
var _this;
|
|
1528
|
-
|
|
1529
1188
|
_this = _TemporalAccessor.call(this) || this;
|
|
1530
|
-
_this._value = MathUtil$
|
|
1189
|
+
_this._value = MathUtil$3.safeToInt(value);
|
|
1531
1190
|
_this._name = name;
|
|
1532
1191
|
return _this;
|
|
1533
1192
|
}
|
|
1534
|
-
|
|
1535
1193
|
var _proto = Quarter.prototype;
|
|
1536
|
-
|
|
1537
1194
|
_proto.value = function value() {
|
|
1538
1195
|
return this._value;
|
|
1539
1196
|
};
|
|
1540
|
-
|
|
1541
1197
|
_proto.displayName = function displayName(style, locale) {
|
|
1542
1198
|
throw new core.IllegalArgumentException('Pattern using (localized) text not implemented yet!');
|
|
1543
1199
|
};
|
|
1544
|
-
|
|
1545
1200
|
_proto.isSupported = function isSupported(field) {
|
|
1546
1201
|
if (field === core.IsoFields.QUARTER_OF_YEAR) {
|
|
1547
1202
|
return true;
|
|
1548
1203
|
} else if (field instanceof core.ChronoField) {
|
|
1549
1204
|
return false;
|
|
1550
1205
|
}
|
|
1551
|
-
|
|
1552
1206
|
return field != null && field.isSupportedBy(this);
|
|
1553
1207
|
};
|
|
1554
|
-
|
|
1555
1208
|
_proto.range = function range(field) {
|
|
1556
1209
|
requireNonNull(field, 'field');
|
|
1557
|
-
|
|
1558
1210
|
if (field === core.IsoFields.QUARTER_OF_YEAR) {
|
|
1559
1211
|
return field.range();
|
|
1560
1212
|
} else if (field instanceof core.ChronoField) {
|
|
1561
1213
|
throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
|
|
1562
1214
|
}
|
|
1563
|
-
|
|
1564
1215
|
return _TemporalAccessor.prototype.range.call(this, field);
|
|
1565
1216
|
};
|
|
1566
|
-
|
|
1567
1217
|
_proto.get = function get(field) {
|
|
1568
1218
|
requireNonNull(field, 'field');
|
|
1569
1219
|
requireInstance(field, core.TemporalField, 'field');
|
|
1570
1220
|
return this.range(field).checkValidIntValue(this.getLong(field), field);
|
|
1571
1221
|
};
|
|
1572
|
-
|
|
1573
1222
|
_proto.getLong = function getLong(field) {
|
|
1574
1223
|
requireNonNull(field, 'field');
|
|
1575
|
-
|
|
1576
1224
|
if (field === core.IsoFields.QUARTER_OF_YEAR) {
|
|
1577
1225
|
return this.value();
|
|
1578
1226
|
} else if (field instanceof core.ChronoField) {
|
|
1579
1227
|
throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
|
|
1580
1228
|
}
|
|
1581
|
-
|
|
1582
1229
|
return field.getFrom(this);
|
|
1583
1230
|
};
|
|
1584
|
-
|
|
1585
1231
|
_proto.plus = function plus(quarters) {
|
|
1586
|
-
var amount = MathUtil$
|
|
1232
|
+
var amount = MathUtil$3.intMod(quarters, 4);
|
|
1587
1233
|
return QUARTERS[(this.ordinal() + amount + 4) % 4];
|
|
1588
1234
|
};
|
|
1589
|
-
|
|
1590
1235
|
_proto.minus = function minus(quarters) {
|
|
1591
|
-
return this.plus(-MathUtil$
|
|
1236
|
+
return this.plus(-MathUtil$3.intMod(quarters, 4));
|
|
1592
1237
|
};
|
|
1593
|
-
|
|
1594
1238
|
_proto.length = function length(leapYear) {
|
|
1595
1239
|
switch (this) {
|
|
1596
1240
|
case Quarter.Q1:
|
|
1597
1241
|
return leapYear ? 91 : 90;
|
|
1598
|
-
|
|
1599
1242
|
case Quarter.Q2:
|
|
1600
1243
|
return 91;
|
|
1601
|
-
|
|
1602
1244
|
default:
|
|
1603
1245
|
return 92;
|
|
1604
1246
|
}
|
|
1605
1247
|
};
|
|
1606
|
-
|
|
1607
1248
|
_proto.firstMonth = function firstMonth() {
|
|
1608
1249
|
switch (this) {
|
|
1609
1250
|
case Quarter.Q1:
|
|
1610
1251
|
return core.Month.JANUARY;
|
|
1611
|
-
|
|
1612
1252
|
case Quarter.Q2:
|
|
1613
1253
|
return core.Month.APRIL;
|
|
1614
|
-
|
|
1615
1254
|
case Quarter.Q3:
|
|
1616
1255
|
return core.Month.JULY;
|
|
1617
|
-
|
|
1618
1256
|
case Quarter.Q4:
|
|
1619
1257
|
return core.Month.OCTOBER;
|
|
1620
|
-
|
|
1621
1258
|
default:
|
|
1622
1259
|
throw new core.IllegalStateException('Unreachable');
|
|
1623
1260
|
}
|
|
1624
1261
|
};
|
|
1625
|
-
|
|
1626
1262
|
_proto.query = function query(_query) {
|
|
1627
1263
|
requireNonNull(_query, 'query');
|
|
1628
1264
|
requireInstance(_query, core.TemporalQuery, 'query');
|
|
1629
|
-
|
|
1630
1265
|
if (_query === core.TemporalQueries.chronology()) {
|
|
1631
1266
|
return core.IsoChronology.INSTANCE;
|
|
1632
1267
|
} else if (_query === core.TemporalQueries.precision()) {
|
|
1633
1268
|
return core.IsoFields.QUARTER_YEARS;
|
|
1634
1269
|
}
|
|
1635
|
-
|
|
1636
1270
|
return _TemporalAccessor.prototype.query.call(this, _query);
|
|
1637
1271
|
};
|
|
1638
|
-
|
|
1639
1272
|
_proto.adjustInto = function adjustInto(temporal) {
|
|
1640
1273
|
requireNonNull(temporal, 'temporal');
|
|
1641
1274
|
return temporal.with(core.IsoFields.QUARTER_OF_YEAR, this.value());
|
|
1642
1275
|
};
|
|
1643
|
-
|
|
1644
1276
|
_proto.ordinal = function ordinal() {
|
|
1645
1277
|
return this._value - 1;
|
|
1646
1278
|
};
|
|
1647
|
-
|
|
1648
1279
|
_proto.name = function name() {
|
|
1649
1280
|
return this._name;
|
|
1650
1281
|
};
|
|
1651
|
-
|
|
1652
1282
|
_proto.compareTo = function compareTo(other) {
|
|
1653
1283
|
requireNonNull(other, 'other');
|
|
1654
1284
|
requireInstance(other, Quarter, 'other');
|
|
1655
1285
|
return this._value - other._value;
|
|
1656
1286
|
};
|
|
1657
|
-
|
|
1658
1287
|
_proto.toString = function toString() {
|
|
1659
1288
|
return this.name();
|
|
1660
1289
|
};
|
|
1661
|
-
|
|
1662
1290
|
_proto.equals = function equals(other) {
|
|
1663
1291
|
return this === other;
|
|
1664
1292
|
};
|
|
1665
|
-
|
|
1666
1293
|
_proto.hashCode = function hashCode() {
|
|
1667
1294
|
return this._value;
|
|
1668
1295
|
};
|
|
1669
|
-
|
|
1670
1296
|
return Quarter;
|
|
1671
1297
|
}(core.TemporalAccessor);
|
|
1672
1298
|
var QUARTERS;
|
|
1673
|
-
function _init$
|
|
1299
|
+
function _init$3() {
|
|
1674
1300
|
Quarter.Q1 = new Quarter(1, 'Q1');
|
|
1675
1301
|
Quarter.Q2 = new Quarter(2, 'Q2');
|
|
1676
1302
|
Quarter.Q3 = new Quarter(3, 'Q3');
|
|
@@ -1680,26 +1306,204 @@
|
|
|
1680
1306
|
});
|
|
1681
1307
|
QUARTERS = [Quarter.Q1, Quarter.Q2, Quarter.Q3, Quarter.Q4];
|
|
1682
1308
|
}
|
|
1683
|
-
|
|
1684
1309
|
function createTemporalQuery$2(name, queryFromFunction) {
|
|
1685
1310
|
var ExtendedTemporalQuery = function (_TemporalQuery) {
|
|
1686
1311
|
_inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
|
|
1687
|
-
|
|
1688
1312
|
function ExtendedTemporalQuery() {
|
|
1689
1313
|
return _TemporalQuery.apply(this, arguments) || this;
|
|
1690
1314
|
}
|
|
1691
|
-
|
|
1692
1315
|
return ExtendedTemporalQuery;
|
|
1693
1316
|
}(core.TemporalQuery);
|
|
1694
|
-
|
|
1695
1317
|
ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
|
|
1696
1318
|
return new ExtendedTemporalQuery(name);
|
|
1697
1319
|
}
|
|
1698
1320
|
|
|
1321
|
+
var MathUtil$2 = core._.MathUtil;
|
|
1322
|
+
var Temporals = function () {
|
|
1323
|
+
Temporals.nextWorkingDay = function nextWorkingDay() {
|
|
1324
|
+
return Adjuster.NEXT_WORKING;
|
|
1325
|
+
};
|
|
1326
|
+
Temporals.nextWorkingDayOrSame = function nextWorkingDayOrSame() {
|
|
1327
|
+
return Adjuster.NEXT_WORKING_OR_SAME;
|
|
1328
|
+
};
|
|
1329
|
+
Temporals.previousWorkingDay = function previousWorkingDay() {
|
|
1330
|
+
return Adjuster.PREVIOUS_WORKING;
|
|
1331
|
+
};
|
|
1332
|
+
Temporals.previousWorkingDayOrSame = function previousWorkingDayOrSame() {
|
|
1333
|
+
return Adjuster.PREVIOUS_WORKING_OR_SAME;
|
|
1334
|
+
};
|
|
1335
|
+
Temporals.parseFirstMatching = function parseFirstMatching(text, query) {
|
|
1336
|
+
requireNonNull(text, 'text');
|
|
1337
|
+
requireNonNull(query, 'query');
|
|
1338
|
+
for (var _len = arguments.length, formatters = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
1339
|
+
formatters[_key - 2] = arguments[_key];
|
|
1340
|
+
}
|
|
1341
|
+
requireNonNull(formatters, 'formatters');
|
|
1342
|
+
if (formatters.length === 0) {
|
|
1343
|
+
throw new core.DateTimeParseException('No formatters specified', text, 0);
|
|
1344
|
+
}
|
|
1345
|
+
if (formatters.length === 1) {
|
|
1346
|
+
return formatters[0].parse(text, query);
|
|
1347
|
+
}
|
|
1348
|
+
for (var _i = 0, _formatters = formatters; _i < _formatters.length; _i++) {
|
|
1349
|
+
var formatter = _formatters[_i];
|
|
1350
|
+
try {
|
|
1351
|
+
var pp = new core.ParsePosition(0);
|
|
1352
|
+
formatter.parseUnresolved(text, pp);
|
|
1353
|
+
var len = text.length;
|
|
1354
|
+
if (pp.getErrorIndex() === -1 && pp.getIndex() === len) {
|
|
1355
|
+
return formatter.parse(text, query);
|
|
1356
|
+
}
|
|
1357
|
+
} catch (ignored) {}
|
|
1358
|
+
}
|
|
1359
|
+
throw new core.DateTimeParseException("Text '" + text + "' could not be parsed", text, 0);
|
|
1360
|
+
};
|
|
1361
|
+
Temporals.convertAmount = function convertAmount(amount, fromUnit, toUnit) {
|
|
1362
|
+
requireNonNull(fromUnit, 'fromUnit');
|
|
1363
|
+
requireNonNull(toUnit, 'toUnit');
|
|
1364
|
+
Temporals._validateUnit(fromUnit);
|
|
1365
|
+
Temporals._validateUnit(toUnit);
|
|
1366
|
+
if (fromUnit === toUnit) {
|
|
1367
|
+
return [amount, 0];
|
|
1368
|
+
}
|
|
1369
|
+
if (Temporals._isPrecise(fromUnit) && Temporals._isPrecise(toUnit)) {
|
|
1370
|
+
var fromNanos = fromUnit.duration().toNanos();
|
|
1371
|
+
var toNanos = toUnit.duration().toNanos();
|
|
1372
|
+
if (fromNanos > toNanos) {
|
|
1373
|
+
var multiple = MathUtil$2.intDiv(fromNanos, toNanos);
|
|
1374
|
+
return [MathUtil$2.safeMultiply(amount, multiple), 0];
|
|
1375
|
+
} else {
|
|
1376
|
+
var _multiple = MathUtil$2.intDiv(toNanos, fromNanos);
|
|
1377
|
+
return [MathUtil$2.intDiv(amount, _multiple), MathUtil$2.intMod(amount, _multiple)];
|
|
1378
|
+
}
|
|
1379
|
+
}
|
|
1380
|
+
var fromMonthFactor = Temporals._monthMonthFactor(fromUnit, fromUnit, toUnit);
|
|
1381
|
+
var toMonthFactor = Temporals._monthMonthFactor(toUnit, fromUnit, toUnit);
|
|
1382
|
+
if (fromMonthFactor > toMonthFactor) {
|
|
1383
|
+
var _multiple2 = MathUtil$2.intDiv(fromMonthFactor, toMonthFactor);
|
|
1384
|
+
return [MathUtil$2.safeMultiply(amount, _multiple2), 0];
|
|
1385
|
+
} else {
|
|
1386
|
+
var _multiple3 = MathUtil$2.intDiv(toMonthFactor, fromMonthFactor);
|
|
1387
|
+
return [MathUtil$2.intDiv(amount, _multiple3), MathUtil$2.intMod(amount, _multiple3)];
|
|
1388
|
+
}
|
|
1389
|
+
};
|
|
1390
|
+
Temporals._validateUnit = function _validateUnit(unit) {
|
|
1391
|
+
if (unit instanceof core.ChronoUnit) {
|
|
1392
|
+
if (unit === core.ChronoUnit.ERAS || unit === core.ChronoUnit.FOREVER) {
|
|
1393
|
+
throw new core.UnsupportedTemporalTypeException("Unsupported TemporalUnit: " + unit);
|
|
1394
|
+
}
|
|
1395
|
+
} else if (unit !== core.IsoFields.QUARTER_YEARS) {
|
|
1396
|
+
throw new core.UnsupportedTemporalTypeException("Unsupported TemporalUnit: " + unit);
|
|
1397
|
+
}
|
|
1398
|
+
};
|
|
1399
|
+
Temporals._isPrecise = function _isPrecise(unit) {
|
|
1400
|
+
return unit instanceof core.ChronoUnit && unit.compareTo(core.ChronoUnit.WEEKS) <= 0;
|
|
1401
|
+
};
|
|
1402
|
+
Temporals._monthMonthFactor = function _monthMonthFactor(unit, fromUnit, toUnit) {
|
|
1403
|
+
if (unit instanceof core.ChronoUnit) {
|
|
1404
|
+
switch (unit) {
|
|
1405
|
+
case core.ChronoUnit.MONTHS:
|
|
1406
|
+
return 1;
|
|
1407
|
+
case core.ChronoUnit.YEARS:
|
|
1408
|
+
return 12;
|
|
1409
|
+
case core.ChronoUnit.DECADES:
|
|
1410
|
+
return 120;
|
|
1411
|
+
case core.ChronoUnit.CENTURIES:
|
|
1412
|
+
return 1200;
|
|
1413
|
+
case core.ChronoUnit.MILLENNIA:
|
|
1414
|
+
return 12000;
|
|
1415
|
+
default:
|
|
1416
|
+
throw new core.DateTimeException("Unable to convert between units: " + fromUnit + " to " + toUnit);
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
return 3;
|
|
1420
|
+
};
|
|
1421
|
+
function Temporals() {}
|
|
1422
|
+
return Temporals;
|
|
1423
|
+
}();
|
|
1424
|
+
var Adjuster = {};
|
|
1425
|
+
function _init$2() {
|
|
1426
|
+
Adjuster.NEXT_WORKING = new (function (_TemporalAdjuster) {
|
|
1427
|
+
_inheritsLoose(_class, _TemporalAdjuster);
|
|
1428
|
+
function _class() {
|
|
1429
|
+
return _TemporalAdjuster.apply(this, arguments) || this;
|
|
1430
|
+
}
|
|
1431
|
+
var _proto = _class.prototype;
|
|
1432
|
+
_proto.adjustInto = function adjustInto(temporal) {
|
|
1433
|
+
var dow = temporal.get(core.ChronoField.DAY_OF_WEEK);
|
|
1434
|
+
switch (dow) {
|
|
1435
|
+
case 6:
|
|
1436
|
+
return temporal.plus(2, core.ChronoUnit.DAYS);
|
|
1437
|
+
case 5:
|
|
1438
|
+
return temporal.plus(3, core.ChronoUnit.DAYS);
|
|
1439
|
+
default:
|
|
1440
|
+
return temporal.plus(1, core.ChronoUnit.DAYS);
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
return _class;
|
|
1444
|
+
}(core.TemporalAdjuster))();
|
|
1445
|
+
Adjuster.PREVIOUS_WORKING = new (function (_TemporalAdjuster2) {
|
|
1446
|
+
_inheritsLoose(_class2, _TemporalAdjuster2);
|
|
1447
|
+
function _class2() {
|
|
1448
|
+
return _TemporalAdjuster2.apply(this, arguments) || this;
|
|
1449
|
+
}
|
|
1450
|
+
var _proto2 = _class2.prototype;
|
|
1451
|
+
_proto2.adjustInto = function adjustInto(temporal) {
|
|
1452
|
+
var dow = temporal.get(core.ChronoField.DAY_OF_WEEK);
|
|
1453
|
+
switch (dow) {
|
|
1454
|
+
case 1:
|
|
1455
|
+
return temporal.minus(3, core.ChronoUnit.DAYS);
|
|
1456
|
+
case 7:
|
|
1457
|
+
return temporal.minus(2, core.ChronoUnit.DAYS);
|
|
1458
|
+
default:
|
|
1459
|
+
return temporal.minus(1, core.ChronoUnit.DAYS);
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
return _class2;
|
|
1463
|
+
}(core.TemporalAdjuster))();
|
|
1464
|
+
Adjuster.NEXT_WORKING_OR_SAME = new (function (_TemporalAdjuster3) {
|
|
1465
|
+
_inheritsLoose(_class3, _TemporalAdjuster3);
|
|
1466
|
+
function _class3() {
|
|
1467
|
+
return _TemporalAdjuster3.apply(this, arguments) || this;
|
|
1468
|
+
}
|
|
1469
|
+
var _proto3 = _class3.prototype;
|
|
1470
|
+
_proto3.adjustInto = function adjustInto(temporal) {
|
|
1471
|
+
var dow = temporal.get(core.ChronoField.DAY_OF_WEEK);
|
|
1472
|
+
switch (dow) {
|
|
1473
|
+
case 6:
|
|
1474
|
+
return temporal.plus(2, core.ChronoUnit.DAYS);
|
|
1475
|
+
case 7:
|
|
1476
|
+
return temporal.plus(1, core.ChronoUnit.DAYS);
|
|
1477
|
+
default:
|
|
1478
|
+
return temporal;
|
|
1479
|
+
}
|
|
1480
|
+
};
|
|
1481
|
+
return _class3;
|
|
1482
|
+
}(core.TemporalAdjuster))();
|
|
1483
|
+
Adjuster.PREVIOUS_WORKING_OR_SAME = new (function (_TemporalAdjuster4) {
|
|
1484
|
+
_inheritsLoose(_class4, _TemporalAdjuster4);
|
|
1485
|
+
function _class4() {
|
|
1486
|
+
return _TemporalAdjuster4.apply(this, arguments) || this;
|
|
1487
|
+
}
|
|
1488
|
+
var _proto4 = _class4.prototype;
|
|
1489
|
+
_proto4.adjustInto = function adjustInto(temporal) {
|
|
1490
|
+
var dow = temporal.get(core.ChronoField.DAY_OF_WEEK);
|
|
1491
|
+
switch (dow) {
|
|
1492
|
+
case 6:
|
|
1493
|
+
return temporal.minus(1, core.ChronoUnit.DAYS);
|
|
1494
|
+
case 7:
|
|
1495
|
+
return temporal.minus(2, core.ChronoUnit.DAYS);
|
|
1496
|
+
default:
|
|
1497
|
+
return temporal;
|
|
1498
|
+
}
|
|
1499
|
+
};
|
|
1500
|
+
return _class4;
|
|
1501
|
+
}(core.TemporalAdjuster))();
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1699
1504
|
var MathUtil$1 = core._.MathUtil;
|
|
1700
1505
|
var YearQuarter = function (_Temporal) {
|
|
1701
1506
|
_inheritsLoose(YearQuarter, _Temporal);
|
|
1702
|
-
|
|
1703
1507
|
YearQuarter.now = function now(zoneIdOrClock) {
|
|
1704
1508
|
if (arguments.length === 0) {
|
|
1705
1509
|
return YearQuarter._now0();
|
|
@@ -1709,68 +1513,53 @@
|
|
|
1709
1513
|
return YearQuarter._nowClock(zoneIdOrClock);
|
|
1710
1514
|
}
|
|
1711
1515
|
};
|
|
1712
|
-
|
|
1713
1516
|
YearQuarter._now0 = function _now0() {
|
|
1714
1517
|
return YearQuarter.now(core.Clock.systemDefaultZone());
|
|
1715
1518
|
};
|
|
1716
|
-
|
|
1717
1519
|
YearQuarter._nowZoneId = function _nowZoneId(zone) {
|
|
1718
1520
|
return YearQuarter.now(core.Clock.system(zone));
|
|
1719
1521
|
};
|
|
1720
|
-
|
|
1721
1522
|
YearQuarter._nowClock = function _nowClock(clock) {
|
|
1722
1523
|
var now = core.LocalDate.now(clock);
|
|
1723
1524
|
return YearQuarter.of(now.getYear(), Quarter.from(now.getMonth()));
|
|
1724
1525
|
};
|
|
1725
|
-
|
|
1726
1526
|
YearQuarter.of = function of(year, quarter) {
|
|
1727
1527
|
if (year instanceof core.Year && quarter instanceof Quarter) {
|
|
1728
1528
|
return YearQuarter._ofYearQuarter(year, quarter);
|
|
1729
1529
|
}
|
|
1730
|
-
|
|
1731
1530
|
if (year instanceof core.Year && typeof quarter === 'number') {
|
|
1732
1531
|
return YearQuarter._ofYearInt(year, quarter);
|
|
1733
1532
|
}
|
|
1734
|
-
|
|
1735
1533
|
if (typeof year === 'number' && quarter instanceof Quarter) {
|
|
1736
1534
|
return YearQuarter._ofIntQuarter(year, quarter);
|
|
1737
1535
|
}
|
|
1738
|
-
|
|
1739
1536
|
if (typeof year === 'number' && typeof quarter === 'number') {
|
|
1740
1537
|
return YearQuarter._ofIntInt(year, quarter);
|
|
1741
1538
|
}
|
|
1742
|
-
|
|
1743
1539
|
var yearMessage = "year must be an instance of Year or number but is " + year.constructor.name;
|
|
1744
1540
|
var quarterMessage = "quarter must be an instance of Quarter or number but is " + quarter.constructor.name;
|
|
1745
1541
|
throw new core.IllegalArgumentException(yearMessage + " and " + quarterMessage);
|
|
1746
1542
|
};
|
|
1747
|
-
|
|
1748
1543
|
YearQuarter._ofYearQuarter = function _ofYearQuarter(year, quarter) {
|
|
1749
1544
|
return YearQuarter.of(year.value(), quarter);
|
|
1750
1545
|
};
|
|
1751
|
-
|
|
1752
1546
|
YearQuarter._ofYearInt = function _ofYearInt(year, quarter) {
|
|
1753
1547
|
return YearQuarter.of(year.value(), Quarter.of(quarter));
|
|
1754
1548
|
};
|
|
1755
|
-
|
|
1756
1549
|
YearQuarter._ofIntQuarter = function _ofIntQuarter(year, quarter) {
|
|
1757
1550
|
core.ChronoField.YEAR.checkValidValue(year);
|
|
1758
1551
|
requireNonNull(quarter, 'quarter');
|
|
1759
1552
|
return new YearQuarter(year, quarter);
|
|
1760
1553
|
};
|
|
1761
|
-
|
|
1762
1554
|
YearQuarter._ofIntInt = function _ofIntInt(year, quarter) {
|
|
1763
1555
|
core.ChronoField.YEAR.checkValidValue(year);
|
|
1764
1556
|
return new YearQuarter(year, Quarter.of(quarter));
|
|
1765
1557
|
};
|
|
1766
|
-
|
|
1767
1558
|
YearQuarter.from = function from(temporal) {
|
|
1768
1559
|
if (temporal instanceof YearQuarter) {
|
|
1769
1560
|
return temporal;
|
|
1770
1561
|
}
|
|
1771
|
-
|
|
1772
1562
|
requireNonNull(temporal, 'temporal');
|
|
1773
|
-
|
|
1774
1563
|
try {
|
|
1775
1564
|
var year = MathUtil$1.safeToInt(temporal.getLong(core.ChronoField.YEAR));
|
|
1776
1565
|
var qoy = MathUtil$1.safeToInt(temporal.getLong(core.IsoFields.QUARTER_OF_YEAR));
|
|
@@ -1779,195 +1568,149 @@
|
|
|
1779
1568
|
throw new core.DateTimeException("Unable to obtain YearQuarter from TemporalAccessor: " + temporal + " of type " + temporal.constructor.name, ex);
|
|
1780
1569
|
}
|
|
1781
1570
|
};
|
|
1782
|
-
|
|
1783
1571
|
YearQuarter.parse = function parse(text, formatter) {
|
|
1784
1572
|
if (formatter === void 0) {
|
|
1785
1573
|
formatter = YearQuarter.PARSER;
|
|
1786
1574
|
}
|
|
1787
|
-
|
|
1788
1575
|
requireNonNull(formatter, 'formatter');
|
|
1789
1576
|
requireInstance(formatter, core.DateTimeFormatter, 'formatter');
|
|
1790
1577
|
return formatter.parse(text, YearQuarter.FROM);
|
|
1791
1578
|
};
|
|
1792
|
-
|
|
1793
1579
|
function YearQuarter(year, quarter) {
|
|
1794
1580
|
var _this;
|
|
1795
|
-
|
|
1796
1581
|
_this = _Temporal.call(this) || this;
|
|
1797
1582
|
_this._year = MathUtil$1.safeToInt(year);
|
|
1798
1583
|
_this._quarter = requireInstance(quarter, Quarter, 'Quarter');
|
|
1799
1584
|
return _this;
|
|
1800
1585
|
}
|
|
1801
|
-
|
|
1802
1586
|
var _proto = YearQuarter.prototype;
|
|
1803
|
-
|
|
1804
1587
|
_proto._with = function _with(newYear, newQuarter) {
|
|
1805
1588
|
if (this._year === newYear && this._quarter === newQuarter) {
|
|
1806
1589
|
return this;
|
|
1807
1590
|
}
|
|
1808
|
-
|
|
1809
1591
|
return new YearQuarter(newYear, newQuarter);
|
|
1810
1592
|
};
|
|
1811
|
-
|
|
1812
1593
|
_proto.isSupported = function isSupported(fieldOrUnit) {
|
|
1813
1594
|
if (fieldOrUnit instanceof core.TemporalField) {
|
|
1814
1595
|
return this._isSupportedField(fieldOrUnit);
|
|
1815
1596
|
}
|
|
1816
|
-
|
|
1817
1597
|
if (fieldOrUnit instanceof core.TemporalUnit) {
|
|
1818
1598
|
return this._isSupportedUnit(fieldOrUnit);
|
|
1819
1599
|
}
|
|
1820
|
-
|
|
1821
1600
|
if (fieldOrUnit == null) {
|
|
1822
1601
|
return false;
|
|
1823
1602
|
}
|
|
1824
|
-
|
|
1825
1603
|
throw new core.IllegalArgumentException("fieldOrUnit must be an instance of TemporalField or TemporalUnit, but is " + fieldOrUnit.constructor.name);
|
|
1826
1604
|
};
|
|
1827
|
-
|
|
1828
1605
|
_proto._isSupportedField = function _isSupportedField(field) {
|
|
1829
1606
|
if (field === core.IsoFields.QUARTER_OF_YEAR) {
|
|
1830
1607
|
return true;
|
|
1831
1608
|
} else if (field instanceof core.ChronoField) {
|
|
1832
1609
|
return field === core.ChronoField.YEAR || field === core.ChronoField.YEAR_OF_ERA || field === core.ChronoField.ERA;
|
|
1833
1610
|
}
|
|
1834
|
-
|
|
1835
1611
|
return field != null && field.isSupportedBy(this);
|
|
1836
1612
|
};
|
|
1837
|
-
|
|
1838
1613
|
_proto._isSupportedUnit = function _isSupportedUnit(unit) {
|
|
1839
1614
|
if (unit === core.IsoFields.QUARTER_YEARS) {
|
|
1840
1615
|
return true;
|
|
1841
1616
|
} else if (unit instanceof core.ChronoUnit) {
|
|
1842
1617
|
return unit === core.ChronoUnit.YEARS || unit === core.ChronoUnit.DECADES || unit === core.ChronoUnit.CENTURIES || unit === core.ChronoUnit.MILLENNIA || unit === core.ChronoUnit.ERAS;
|
|
1843
1618
|
}
|
|
1844
|
-
|
|
1845
1619
|
return unit != null && unit.isSupportedBy(this);
|
|
1846
1620
|
};
|
|
1847
|
-
|
|
1848
1621
|
_proto.range = function range(field) {
|
|
1849
1622
|
requireNonNull(field, 'field');
|
|
1850
1623
|
requireInstance(field, core.TemporalField, 'field');
|
|
1851
|
-
|
|
1852
1624
|
if (field === core.IsoFields.QUARTER_OF_YEAR) {
|
|
1853
1625
|
return core.IsoFields.QUARTER_OF_YEAR.range();
|
|
1854
1626
|
}
|
|
1855
|
-
|
|
1856
1627
|
if (field === core.ChronoField.YEAR_OF_ERA) {
|
|
1857
1628
|
return this.year() <= 0 ? core.ValueRange.of(1, core.Year.MAX_VALUE + 1) : core.ValueRange.of(1, core.Year.MAX_VALUE);
|
|
1858
1629
|
}
|
|
1859
|
-
|
|
1860
1630
|
return _Temporal.prototype.range.call(this, field);
|
|
1861
1631
|
};
|
|
1862
|
-
|
|
1863
1632
|
_proto.get = function get(field) {
|
|
1864
1633
|
requireNonNull(field, 'field');
|
|
1865
1634
|
requireInstance(field, core.TemporalField, 'field');
|
|
1866
1635
|
return this.range(field).checkValidIntValue(this.getLong(field), field);
|
|
1867
1636
|
};
|
|
1868
|
-
|
|
1869
1637
|
_proto.getLong = function getLong(field) {
|
|
1870
1638
|
requireNonNull(field, 'field');
|
|
1871
1639
|
requireInstance(field, core.TemporalField, 'field');
|
|
1872
|
-
|
|
1873
1640
|
if (field === core.IsoFields.QUARTER_OF_YEAR) {
|
|
1874
1641
|
return this._quarter.value();
|
|
1875
1642
|
} else if (field instanceof core.ChronoField) {
|
|
1876
1643
|
switch (field) {
|
|
1877
1644
|
case core.ChronoField.YEAR_OF_ERA:
|
|
1878
1645
|
return this._year < 1 ? 1 - this._year : this._year;
|
|
1879
|
-
|
|
1880
1646
|
case core.ChronoField.YEAR:
|
|
1881
1647
|
return this._year;
|
|
1882
|
-
|
|
1883
1648
|
case core.ChronoField.ERA:
|
|
1884
1649
|
return this._year < 1 ? 0 : 1;
|
|
1885
|
-
|
|
1886
1650
|
default:
|
|
1887
1651
|
throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
|
|
1888
1652
|
}
|
|
1889
1653
|
}
|
|
1890
|
-
|
|
1891
1654
|
return _Temporal.prototype.get.call(this, field);
|
|
1892
1655
|
};
|
|
1893
|
-
|
|
1894
1656
|
_proto._prolepticQuarter = function _prolepticQuarter() {
|
|
1895
1657
|
return this._year * 4 + (this._quarter.value() - 1);
|
|
1896
1658
|
};
|
|
1897
|
-
|
|
1898
1659
|
_proto.year = function year() {
|
|
1899
1660
|
return this._year;
|
|
1900
1661
|
};
|
|
1901
|
-
|
|
1902
1662
|
_proto.quarterValue = function quarterValue() {
|
|
1903
1663
|
return this._quarter.value();
|
|
1904
1664
|
};
|
|
1905
|
-
|
|
1906
1665
|
_proto.quarter = function quarter() {
|
|
1907
1666
|
return this._quarter;
|
|
1908
1667
|
};
|
|
1909
|
-
|
|
1910
1668
|
_proto.isLeapYear = function isLeapYear() {
|
|
1911
1669
|
return core.IsoChronology.isLeapYear(this._year);
|
|
1912
1670
|
};
|
|
1913
|
-
|
|
1914
1671
|
_proto.isValidDay = function isValidDay(dayOfQuarter) {
|
|
1915
1672
|
return dayOfQuarter >= 1 && dayOfQuarter <= this.lengthOfQuarter();
|
|
1916
1673
|
};
|
|
1917
|
-
|
|
1918
1674
|
_proto.lengthOfQuarter = function lengthOfQuarter() {
|
|
1919
1675
|
return this._quarter.length(this.isLeapYear());
|
|
1920
1676
|
};
|
|
1921
|
-
|
|
1922
1677
|
_proto.lengthOfYear = function lengthOfYear() {
|
|
1923
1678
|
return this.isLeapYear() ? 366 : 365;
|
|
1924
1679
|
};
|
|
1925
|
-
|
|
1926
1680
|
_proto._withAdjuster = function _withAdjuster(adjuster) {
|
|
1927
1681
|
if (adjuster instanceof YearQuarter) {
|
|
1928
1682
|
return adjuster;
|
|
1929
1683
|
}
|
|
1930
|
-
|
|
1931
1684
|
return _Temporal.prototype._withAdjuster.call(this, adjuster);
|
|
1932
1685
|
};
|
|
1933
|
-
|
|
1934
1686
|
_proto._withField = function _withField(field, newValue) {
|
|
1935
1687
|
requireNonNull(field, 'field');
|
|
1936
1688
|
requireInstance(field, core.TemporalField, 'field');
|
|
1937
|
-
|
|
1938
1689
|
if (field === core.IsoFields.QUARTER_OF_YEAR) {
|
|
1939
1690
|
return this.withQuarter(core.IsoFields.QUARTER_OF_YEAR.range().checkValidIntValue(newValue, core.IsoFields.QUARTER_OF_YEAR));
|
|
1940
1691
|
} else if (field instanceof core.ChronoField) {
|
|
1941
1692
|
field.checkValidValue(newValue);
|
|
1942
|
-
|
|
1943
1693
|
switch (field) {
|
|
1944
1694
|
case core.ChronoField.YEAR_OF_ERA:
|
|
1945
1695
|
return this.withYear(this._year < 1 ? 1 - newValue : newValue);
|
|
1946
|
-
|
|
1947
1696
|
case core.ChronoField.YEAR:
|
|
1948
1697
|
return this.withYear(newValue);
|
|
1949
|
-
|
|
1950
1698
|
case core.ChronoField.ERA:
|
|
1951
1699
|
return this.getLong(core.ChronoField.ERA) === newValue ? this : this.withYear(1 - this._year);
|
|
1952
|
-
|
|
1953
1700
|
default:
|
|
1954
1701
|
throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
|
|
1955
1702
|
}
|
|
1956
1703
|
}
|
|
1957
|
-
|
|
1958
1704
|
return field.adjustInto(this, newValue);
|
|
1959
1705
|
};
|
|
1960
|
-
|
|
1961
1706
|
_proto.withYear = function withYear(year) {
|
|
1962
1707
|
core.ChronoField.YEAR.checkValidValue(year);
|
|
1963
1708
|
return this._with(year, this._quarter);
|
|
1964
1709
|
};
|
|
1965
|
-
|
|
1966
1710
|
_proto.withQuarter = function withQuarter(quarter) {
|
|
1967
1711
|
core.IsoFields.QUARTER_OF_YEAR.range().checkValidValue(quarter, core.IsoFields.QUARTER_OF_YEAR);
|
|
1968
1712
|
return this._with(this._year, Quarter.of(quarter));
|
|
1969
1713
|
};
|
|
1970
|
-
|
|
1971
1714
|
_proto._plusUnit = function _plusUnit(amountToAdd, unit) {
|
|
1972
1715
|
if (unit === core.IsoFields.QUARTER_YEARS) {
|
|
1973
1716
|
return this.plusQuarters(amountToAdd);
|
|
@@ -1975,176 +1718,133 @@
|
|
|
1975
1718
|
switch (unit) {
|
|
1976
1719
|
case core.ChronoUnit.YEARS:
|
|
1977
1720
|
return this.plusYears(amountToAdd);
|
|
1978
|
-
|
|
1979
1721
|
case core.ChronoUnit.DECADES:
|
|
1980
1722
|
return this.plusYears(MathUtil$1.safeMultiply(amountToAdd, 10));
|
|
1981
|
-
|
|
1982
1723
|
case core.ChronoUnit.CENTURIES:
|
|
1983
1724
|
return this.plusYears(MathUtil$1.safeMultiply(amountToAdd, 100));
|
|
1984
|
-
|
|
1985
1725
|
case core.ChronoUnit.MILLENNIA:
|
|
1986
1726
|
return this.plusYears(MathUtil$1.safeMultiply(amountToAdd, 1000));
|
|
1987
|
-
|
|
1988
1727
|
case core.ChronoUnit.ERAS:
|
|
1989
1728
|
return this.with(core.ChronoField.ERA, MathUtil$1.safeAdd(this.getLong(core.ChronoField.ERA), amountToAdd));
|
|
1990
|
-
|
|
1991
1729
|
default:
|
|
1992
1730
|
throw new core.UnsupportedTemporalTypeException("Unsupported unit: " + unit);
|
|
1993
1731
|
}
|
|
1994
1732
|
}
|
|
1995
|
-
|
|
1996
1733
|
return unit.addTo(this, amountToAdd);
|
|
1997
1734
|
};
|
|
1998
|
-
|
|
1999
1735
|
_proto.plusYears = function plusYears(yearsToAdd) {
|
|
2000
1736
|
if (yearsToAdd === 0) {
|
|
2001
1737
|
return this;
|
|
2002
1738
|
}
|
|
2003
|
-
|
|
2004
1739
|
var newYear = core.ChronoField.YEAR.checkValidIntValue(this._year + yearsToAdd);
|
|
2005
1740
|
return this._with(newYear, this._quarter);
|
|
2006
1741
|
};
|
|
2007
|
-
|
|
2008
1742
|
_proto.plusQuarters = function plusQuarters(quartersToAdd) {
|
|
2009
1743
|
if (quartersToAdd === 0) {
|
|
2010
1744
|
return this;
|
|
2011
1745
|
}
|
|
2012
|
-
|
|
2013
1746
|
var quarterCount = this._year * 4 + (this._quarter.value() - 1);
|
|
2014
1747
|
var calcQuarters = quarterCount + quartersToAdd;
|
|
2015
1748
|
var newYear = core.ChronoField.YEAR.checkValidIntValue(MathUtil$1.intDiv(calcQuarters, 4));
|
|
2016
1749
|
var newQuarter = MathUtil$1.floorMod(calcQuarters, 4) + 1;
|
|
2017
1750
|
return this._with(newYear, Quarter.of(newQuarter));
|
|
2018
1751
|
};
|
|
2019
|
-
|
|
2020
1752
|
_proto.minusYears = function minusYears(yearsToSubtract) {
|
|
2021
1753
|
return yearsToSubtract === MathUtil$1.MIN_SAFE_INTEGER ? this.plusYears(MathUtil$1.MIN_SAFE_INTEGER).plusYears(1) : this.plusYears(-yearsToSubtract);
|
|
2022
1754
|
};
|
|
2023
|
-
|
|
2024
1755
|
_proto.minusQuarters = function minusQuarters(quartersToSubtract) {
|
|
2025
1756
|
return quartersToSubtract === MathUtil$1.MIN_SAFE_INTEGER ? this.plusQuarters(MathUtil$1.MIN_SAFE_INTEGER).plusQuarters(1) : this.plusQuarters(-quartersToSubtract);
|
|
2026
1757
|
};
|
|
2027
|
-
|
|
2028
1758
|
_proto.query = function query(_query) {
|
|
2029
1759
|
if (_query === core.TemporalQueries.chronology()) {
|
|
2030
1760
|
return core.IsoChronology.INSTANCE;
|
|
2031
1761
|
} else if (_query === core.TemporalQueries.precision()) {
|
|
2032
1762
|
return core.IsoFields.QUARTER_YEARS;
|
|
2033
1763
|
}
|
|
2034
|
-
|
|
2035
1764
|
return _Temporal.prototype.query.call(this, _query);
|
|
2036
1765
|
};
|
|
2037
|
-
|
|
2038
1766
|
_proto.adjustInto = function adjustInto(temporal) {
|
|
2039
1767
|
var newProlepticQuarter = this._prolepticQuarter();
|
|
2040
|
-
|
|
2041
1768
|
var oldProlepticQuarter = temporal.get(core.ChronoField.YEAR) * 4 + (temporal.get(core.IsoFields.QUARTER_OF_YEAR) - 1);
|
|
2042
1769
|
return temporal.plus(newProlepticQuarter - oldProlepticQuarter, core.IsoFields.QUARTER_YEARS);
|
|
2043
1770
|
};
|
|
2044
|
-
|
|
2045
1771
|
_proto.until = function until(endExclusive, unit) {
|
|
2046
1772
|
requireNonNull(endExclusive, 'endExclusive');
|
|
2047
1773
|
requireNonNull(unit, 'unit');
|
|
2048
1774
|
requireInstance(endExclusive, core.Temporal, 'endExclusive');
|
|
2049
1775
|
requireInstance(unit, core.TemporalUnit, 'unit');
|
|
2050
1776
|
var end = YearQuarter.from(endExclusive);
|
|
2051
|
-
|
|
2052
1777
|
var quartersUntil = end._prolepticQuarter() - this._prolepticQuarter();
|
|
2053
|
-
|
|
2054
1778
|
if (unit === core.IsoFields.QUARTER_YEARS) {
|
|
2055
1779
|
return quartersUntil;
|
|
2056
1780
|
} else if (unit instanceof core.ChronoUnit) {
|
|
2057
1781
|
switch (unit) {
|
|
2058
1782
|
case core.ChronoUnit.YEARS:
|
|
2059
1783
|
return MathUtil$1.intDiv(quartersUntil, 4);
|
|
2060
|
-
|
|
2061
1784
|
case core.ChronoUnit.DECADES:
|
|
2062
1785
|
return MathUtil$1.intDiv(quartersUntil, 40);
|
|
2063
|
-
|
|
2064
1786
|
case core.ChronoUnit.CENTURIES:
|
|
2065
1787
|
return MathUtil$1.intDiv(quartersUntil, 400);
|
|
2066
|
-
|
|
2067
1788
|
case core.ChronoUnit.MILLENNIA:
|
|
2068
1789
|
return MathUtil$1.intDiv(quartersUntil, 4000);
|
|
2069
|
-
|
|
2070
1790
|
case core.ChronoUnit.ERAS:
|
|
2071
1791
|
return end.getLong(core.ChronoField.ERA) - this.getLong(core.ChronoField.ERA);
|
|
2072
|
-
|
|
2073
1792
|
default:
|
|
2074
1793
|
throw new core.UnsupportedTemporalTypeException("Unsupported unit: " + unit);
|
|
2075
1794
|
}
|
|
2076
1795
|
}
|
|
2077
|
-
|
|
2078
1796
|
return unit.between(this, end);
|
|
2079
1797
|
};
|
|
2080
|
-
|
|
2081
1798
|
_proto.format = function format(formatter) {
|
|
2082
1799
|
requireNonNull(formatter, 'formatter');
|
|
2083
1800
|
return formatter.format(this);
|
|
2084
1801
|
};
|
|
2085
|
-
|
|
2086
1802
|
_proto.atDay = function atDay(dayOfQuarter) {
|
|
2087
1803
|
core.ValueRange.of(1, this.lengthOfQuarter()).checkValidValue(dayOfQuarter, core.IsoFields.DAY_OF_QUARTER);
|
|
2088
1804
|
var leap = core.Year.isLeap(this._year);
|
|
2089
|
-
|
|
2090
1805
|
var month = this._quarter.firstMonth();
|
|
2091
|
-
|
|
2092
1806
|
while (dayOfQuarter > month.length(leap)) {
|
|
2093
1807
|
dayOfQuarter -= month.length(leap);
|
|
2094
1808
|
month = month.plus(1);
|
|
2095
1809
|
}
|
|
2096
|
-
|
|
2097
1810
|
return core.LocalDate.of(this._year, month, dayOfQuarter);
|
|
2098
1811
|
};
|
|
2099
|
-
|
|
2100
1812
|
_proto.atEndOfQuarter = function atEndOfQuarter() {
|
|
2101
1813
|
var month = this._quarter.firstMonth().plus(2);
|
|
2102
|
-
|
|
2103
1814
|
return core.LocalDate.of(this._year, month, month.maxLength());
|
|
2104
1815
|
};
|
|
2105
|
-
|
|
2106
1816
|
_proto.compareTo = function compareTo(other) {
|
|
2107
1817
|
requireNonNull(other, 'other');
|
|
2108
1818
|
requireInstance(other, YearQuarter, 'other');
|
|
2109
1819
|
var cmp = this._year - other._year;
|
|
2110
|
-
|
|
2111
1820
|
if (cmp === 0) {
|
|
2112
1821
|
cmp = this._quarter.compareTo(other._quarter);
|
|
2113
1822
|
}
|
|
2114
|
-
|
|
2115
1823
|
return cmp;
|
|
2116
1824
|
};
|
|
2117
|
-
|
|
2118
1825
|
_proto.isAfter = function isAfter(other) {
|
|
2119
1826
|
return this.compareTo(other) > 0;
|
|
2120
1827
|
};
|
|
2121
|
-
|
|
2122
1828
|
_proto.isBefore = function isBefore(other) {
|
|
2123
1829
|
return this.compareTo(other) < 0;
|
|
2124
1830
|
};
|
|
2125
|
-
|
|
2126
1831
|
_proto.equals = function equals(obj) {
|
|
2127
1832
|
if (this === obj) {
|
|
2128
1833
|
return true;
|
|
2129
1834
|
}
|
|
2130
|
-
|
|
2131
1835
|
if (obj instanceof YearQuarter) {
|
|
2132
1836
|
var other = obj;
|
|
2133
1837
|
return this._year === other._year && this._quarter === other._quarter;
|
|
2134
1838
|
}
|
|
2135
|
-
|
|
2136
1839
|
return false;
|
|
2137
1840
|
};
|
|
2138
|
-
|
|
2139
1841
|
_proto.hashCode = function hashCode() {
|
|
2140
1842
|
return this._year ^ this._quarter.value() << 27;
|
|
2141
1843
|
};
|
|
2142
|
-
|
|
2143
1844
|
_proto.toString = function toString() {
|
|
2144
1845
|
var yearString;
|
|
2145
1846
|
var yearValue = this._year;
|
|
2146
1847
|
var absYear = Math.abs(yearValue);
|
|
2147
|
-
|
|
2148
1848
|
if (absYear < 1000) {
|
|
2149
1849
|
if (yearValue < 0) {
|
|
2150
1850
|
yearString = "-" + ("" + (yearValue - 10000)).slice(-4);
|
|
@@ -2158,10 +1858,8 @@
|
|
|
2158
1858
|
yearString = "" + yearValue;
|
|
2159
1859
|
}
|
|
2160
1860
|
}
|
|
2161
|
-
|
|
2162
1861
|
return yearString.concat('-').concat(this._quarter);
|
|
2163
1862
|
};
|
|
2164
|
-
|
|
2165
1863
|
return YearQuarter;
|
|
2166
1864
|
}(core.Temporal);
|
|
2167
1865
|
function _init$1() {
|
|
@@ -2170,18 +1868,14 @@
|
|
|
2170
1868
|
return YearQuarter.from(temporal);
|
|
2171
1869
|
});
|
|
2172
1870
|
}
|
|
2173
|
-
|
|
2174
1871
|
function createTemporalQuery$1(name, queryFromFunction) {
|
|
2175
1872
|
var ExtendedTemporalQuery = function (_TemporalQuery) {
|
|
2176
1873
|
_inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
|
|
2177
|
-
|
|
2178
1874
|
function ExtendedTemporalQuery() {
|
|
2179
1875
|
return _TemporalQuery.apply(this, arguments) || this;
|
|
2180
1876
|
}
|
|
2181
|
-
|
|
2182
1877
|
return ExtendedTemporalQuery;
|
|
2183
1878
|
}(core.TemporalQuery);
|
|
2184
|
-
|
|
2185
1879
|
ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
|
|
2186
1880
|
return new ExtendedTemporalQuery(name);
|
|
2187
1881
|
}
|
|
@@ -2189,46 +1883,35 @@
|
|
|
2189
1883
|
var MathUtil = core._.MathUtil;
|
|
2190
1884
|
var YearWeek = function (_Temporal) {
|
|
2191
1885
|
_inheritsLoose(YearWeek, _Temporal);
|
|
2192
|
-
|
|
2193
1886
|
YearWeek.now = function now(zoneIdOrClock) {
|
|
2194
1887
|
switch (arguments.length) {
|
|
2195
1888
|
case 0:
|
|
2196
1889
|
return YearWeek._now0();
|
|
2197
|
-
|
|
2198
1890
|
case 1:
|
|
2199
1891
|
requireNonNull(zoneIdOrClock, 'clockOrZone');
|
|
2200
|
-
|
|
2201
1892
|
if (zoneIdOrClock instanceof core.ZoneId) {
|
|
2202
1893
|
return YearWeek._nowZoneId(zoneIdOrClock);
|
|
2203
1894
|
}
|
|
2204
|
-
|
|
2205
1895
|
if (zoneIdOrClock instanceof core.Clock) {
|
|
2206
1896
|
return YearWeek._nowClock(zoneIdOrClock);
|
|
2207
1897
|
}
|
|
2208
|
-
|
|
2209
1898
|
throw new core.IllegalArgumentException("zoneIdOrClock must be an instance of ZoneId or Clock, but is " + zoneIdOrClock.constructor.name);
|
|
2210
|
-
|
|
2211
1899
|
default:
|
|
2212
1900
|
throw new core.IllegalArgumentException("Invalid number of arguments: " + arguments.length);
|
|
2213
1901
|
}
|
|
2214
1902
|
};
|
|
2215
|
-
|
|
2216
1903
|
YearWeek._now0 = function _now0() {
|
|
2217
1904
|
return YearWeek.now(core.Clock.systemDefaultZone());
|
|
2218
1905
|
};
|
|
2219
|
-
|
|
2220
1906
|
YearWeek._nowZoneId = function _nowZoneId(zone) {
|
|
2221
1907
|
return YearWeek.now(core.Clock.system(zone));
|
|
2222
1908
|
};
|
|
2223
|
-
|
|
2224
1909
|
YearWeek._nowClock = function _nowClock(clock) {
|
|
2225
1910
|
var now = core.LocalDate.now(clock);
|
|
2226
1911
|
return YearWeek.of(now.get(core.IsoFields.WEEK_BASED_YEAR), now.get(core.IsoFields.WEEK_OF_WEEK_BASED_YEAR));
|
|
2227
1912
|
};
|
|
2228
|
-
|
|
2229
1913
|
YearWeek.of = function of(year, week) {
|
|
2230
1914
|
MathUtil.verifyInt(week);
|
|
2231
|
-
|
|
2232
1915
|
if (year instanceof core.Year) {
|
|
2233
1916
|
return this._ofYearWeek(year, week);
|
|
2234
1917
|
} else {
|
|
@@ -2236,42 +1919,32 @@
|
|
|
2236
1919
|
return this._ofWeekBasedYear(year, week);
|
|
2237
1920
|
}
|
|
2238
1921
|
};
|
|
2239
|
-
|
|
2240
1922
|
YearWeek._ofYearWeek = function _ofYearWeek(year, week) {
|
|
2241
1923
|
var weekBasedYear = year.value();
|
|
2242
1924
|
return this._ofWeekBasedYear(weekBasedYear, week);
|
|
2243
1925
|
};
|
|
2244
|
-
|
|
2245
1926
|
YearWeek._ofWeekBasedYear = function _ofWeekBasedYear(weekBasedYear, week) {
|
|
2246
1927
|
core.IsoFields.WEEK_BASED_YEAR.range().checkValidValue(weekBasedYear, core.IsoFields.WEEK_BASED_YEAR);
|
|
2247
1928
|
core.IsoFields.WEEK_OF_WEEK_BASED_YEAR.range().checkValidValue(week, core.IsoFields.WEEK_OF_WEEK_BASED_YEAR);
|
|
2248
|
-
|
|
2249
1929
|
if (week === 53 && YearWeek._weekRange(weekBasedYear) < 53) {
|
|
2250
1930
|
week = 1;
|
|
2251
1931
|
weekBasedYear++;
|
|
2252
1932
|
core.IsoFields.WEEK_BASED_YEAR.range().checkValidValue(weekBasedYear, core.IsoFields.WEEK_BASED_YEAR);
|
|
2253
1933
|
}
|
|
2254
|
-
|
|
2255
1934
|
return new YearWeek(weekBasedYear, week);
|
|
2256
1935
|
};
|
|
2257
|
-
|
|
2258
1936
|
YearWeek._weekRange = function _weekRange(weekBasedYear) {
|
|
2259
1937
|
var date = core.LocalDate.of(weekBasedYear, 1, 1);
|
|
2260
|
-
|
|
2261
1938
|
if (date.dayOfWeek() === core.DayOfWeek.THURSDAY || date.dayOfWeek() === core.DayOfWeek.WEDNESDAY && date.isLeapYear()) {
|
|
2262
1939
|
return 53;
|
|
2263
1940
|
}
|
|
2264
|
-
|
|
2265
1941
|
return 52;
|
|
2266
1942
|
};
|
|
2267
|
-
|
|
2268
1943
|
YearWeek.from = function from(temporal) {
|
|
2269
1944
|
if (temporal instanceof YearWeek) {
|
|
2270
1945
|
return temporal;
|
|
2271
1946
|
}
|
|
2272
|
-
|
|
2273
1947
|
requireNonNull(temporal, 'temporal');
|
|
2274
|
-
|
|
2275
1948
|
try {
|
|
2276
1949
|
var year = MathUtil.safeToInt(temporal.getLong(core.IsoFields.WEEK_BASED_YEAR));
|
|
2277
1950
|
var week = MathUtil.safeToInt(temporal.getLong(core.IsoFields.WEEK_OF_WEEK_BASED_YEAR));
|
|
@@ -2280,123 +1953,93 @@
|
|
|
2280
1953
|
throw new core.DateTimeException("Unable to obtain YearWeek from TemporalAccessor: " + temporal.constructor.name, ex);
|
|
2281
1954
|
}
|
|
2282
1955
|
};
|
|
2283
|
-
|
|
2284
1956
|
YearWeek.parse = function parse(text, formatter) {
|
|
2285
1957
|
if (formatter === void 0) {
|
|
2286
1958
|
formatter = YearWeek.PARSER;
|
|
2287
1959
|
}
|
|
2288
|
-
|
|
2289
1960
|
assert(formatter != null, 'formatter', core.NullPointerException);
|
|
2290
1961
|
return formatter.parse(text, YearWeek.FROM);
|
|
2291
1962
|
};
|
|
2292
|
-
|
|
2293
1963
|
function YearWeek(weekBasedYear, week) {
|
|
2294
1964
|
var _this;
|
|
2295
|
-
|
|
2296
1965
|
_this = _Temporal.call(this) || this;
|
|
2297
1966
|
_this._year = weekBasedYear;
|
|
2298
1967
|
_this._week = week;
|
|
2299
1968
|
return _this;
|
|
2300
1969
|
}
|
|
2301
|
-
|
|
2302
1970
|
var _proto = YearWeek.prototype;
|
|
2303
|
-
|
|
2304
1971
|
_proto.isSupported = function isSupported(fieldOrUnit) {
|
|
2305
1972
|
if (fieldOrUnit instanceof core.TemporalField) {
|
|
2306
1973
|
return this._isSupportedField(fieldOrUnit);
|
|
2307
1974
|
}
|
|
2308
|
-
|
|
2309
1975
|
if (fieldOrUnit instanceof core.TemporalUnit) {
|
|
2310
1976
|
return this._isSupportedUnit(fieldOrUnit);
|
|
2311
1977
|
}
|
|
2312
|
-
|
|
2313
1978
|
if (fieldOrUnit == null) {
|
|
2314
1979
|
return false;
|
|
2315
1980
|
}
|
|
2316
|
-
|
|
2317
1981
|
throw new core.IllegalArgumentException("fieldOrUnit must be an instance of TemporalField or TemporalUnit, but is " + fieldOrUnit.constructor.name);
|
|
2318
1982
|
};
|
|
2319
|
-
|
|
2320
1983
|
_proto._isSupportedField = function _isSupportedField(field) {
|
|
2321
1984
|
if (field === core.IsoFields.WEEK_OF_WEEK_BASED_YEAR || field === core.IsoFields.WEEK_BASED_YEAR) {
|
|
2322
1985
|
return true;
|
|
2323
1986
|
} else if (field instanceof core.ChronoField) {
|
|
2324
1987
|
return false;
|
|
2325
1988
|
}
|
|
2326
|
-
|
|
2327
1989
|
return field != null && field.isSupportedBy(this);
|
|
2328
1990
|
};
|
|
2329
|
-
|
|
2330
1991
|
_proto._isSupportedUnit = function _isSupportedUnit(unit) {
|
|
2331
1992
|
if (unit === core.ChronoUnit.WEEKS || unit === core.IsoFields.WEEK_BASED_YEARS) {
|
|
2332
1993
|
return true;
|
|
2333
1994
|
} else if (unit instanceof core.ChronoUnit) {
|
|
2334
1995
|
return false;
|
|
2335
1996
|
}
|
|
2336
|
-
|
|
2337
1997
|
return unit != null && unit.isSupportedBy(this);
|
|
2338
1998
|
};
|
|
2339
|
-
|
|
2340
1999
|
_proto.range = function range(field) {
|
|
2341
2000
|
requireNonNull(field, 'field');
|
|
2342
|
-
|
|
2343
2001
|
if (field === core.IsoFields.WEEK_BASED_YEAR) {
|
|
2344
2002
|
return core.IsoFields.WEEK_BASED_YEAR.range();
|
|
2345
2003
|
}
|
|
2346
|
-
|
|
2347
2004
|
if (field === core.IsoFields.WEEK_OF_WEEK_BASED_YEAR) {
|
|
2348
2005
|
return core.ValueRange.of(1, YearWeek._weekRange(this._year));
|
|
2349
2006
|
}
|
|
2350
|
-
|
|
2351
2007
|
return _Temporal.prototype.range.call(this, field);
|
|
2352
2008
|
};
|
|
2353
|
-
|
|
2354
2009
|
_proto.get = function get(field) {
|
|
2355
2010
|
return this.range(field).checkValidIntValue(this.getLong(field), field);
|
|
2356
2011
|
};
|
|
2357
|
-
|
|
2358
2012
|
_proto.getLong = function getLong(field) {
|
|
2359
2013
|
requireNonNull(field, 'field');
|
|
2360
|
-
|
|
2361
2014
|
if (field === core.IsoFields.WEEK_BASED_YEAR) {
|
|
2362
2015
|
return this._year;
|
|
2363
2016
|
}
|
|
2364
|
-
|
|
2365
2017
|
if (field === core.IsoFields.WEEK_OF_WEEK_BASED_YEAR) {
|
|
2366
2018
|
return this._week;
|
|
2367
2019
|
}
|
|
2368
|
-
|
|
2369
2020
|
if (field instanceof core.ChronoField) {
|
|
2370
2021
|
throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
|
|
2371
2022
|
}
|
|
2372
|
-
|
|
2373
2023
|
return field.getFrom(this);
|
|
2374
2024
|
};
|
|
2375
|
-
|
|
2376
2025
|
_proto.year = function year() {
|
|
2377
2026
|
return this._year;
|
|
2378
2027
|
};
|
|
2379
|
-
|
|
2380
2028
|
_proto.week = function week() {
|
|
2381
2029
|
return this._week;
|
|
2382
2030
|
};
|
|
2383
|
-
|
|
2384
2031
|
_proto.is53WeekYear = function is53WeekYear() {
|
|
2385
2032
|
return YearWeek._weekRange(this._year) === 53;
|
|
2386
2033
|
};
|
|
2387
|
-
|
|
2388
2034
|
_proto.lengthOfYear = function lengthOfYear() {
|
|
2389
2035
|
return this.is53WeekYear() ? 371 : 364;
|
|
2390
2036
|
};
|
|
2391
|
-
|
|
2392
2037
|
_proto._withAdjuster = function _withAdjuster(adjuster) {
|
|
2393
2038
|
if (adjuster instanceof YearWeek) {
|
|
2394
2039
|
return adjuster;
|
|
2395
2040
|
}
|
|
2396
|
-
|
|
2397
2041
|
return _Temporal.prototype._withAdjuster.call(this, adjuster);
|
|
2398
2042
|
};
|
|
2399
|
-
|
|
2400
2043
|
_proto._withField = function _withField(field, newValue) {
|
|
2401
2044
|
if (field === core.IsoFields.WEEK_OF_WEEK_BASED_YEAR) {
|
|
2402
2045
|
return this.withWeek(core.IsoFields.WEEK_OF_WEEK_BASED_YEAR.range().checkValidIntValue(newValue, core.IsoFields.WEEK_OF_WEEK_BASED_YEAR));
|
|
@@ -2405,22 +2048,17 @@
|
|
|
2405
2048
|
} else if (field instanceof core.ChronoField) {
|
|
2406
2049
|
throw new core.UnsupportedTemporalTypeException("Unsupported field: " + field);
|
|
2407
2050
|
}
|
|
2408
|
-
|
|
2409
2051
|
return field.adjustInto(this, newValue);
|
|
2410
2052
|
};
|
|
2411
|
-
|
|
2412
2053
|
_proto.withYear = function withYear(weekBasedYear) {
|
|
2413
2054
|
if (this._week === 53 && YearWeek._weekRange(weekBasedYear) < 53) {
|
|
2414
2055
|
return YearWeek.of(weekBasedYear, 52);
|
|
2415
2056
|
}
|
|
2416
|
-
|
|
2417
2057
|
return YearWeek.of(weekBasedYear, this._week);
|
|
2418
2058
|
};
|
|
2419
|
-
|
|
2420
2059
|
_proto.withWeek = function withWeek(week) {
|
|
2421
2060
|
return YearWeek.of(this._year, week);
|
|
2422
2061
|
};
|
|
2423
|
-
|
|
2424
2062
|
_proto._plusUnit = function _plusUnit(amountToAdd, unit) {
|
|
2425
2063
|
if (unit === core.ChronoUnit.WEEKS) {
|
|
2426
2064
|
return this.plusWeeks(amountToAdd);
|
|
@@ -2429,70 +2067,54 @@
|
|
|
2429
2067
|
} else if (unit instanceof core.ChronoUnit) {
|
|
2430
2068
|
throw new core.UnsupportedTemporalTypeException("Unsupported unit: " + unit);
|
|
2431
2069
|
}
|
|
2432
|
-
|
|
2433
2070
|
return unit.addTo(this, amountToAdd);
|
|
2434
2071
|
};
|
|
2435
|
-
|
|
2436
2072
|
_proto.plusYears = function plusYears(yearsToAdd) {
|
|
2437
2073
|
if (yearsToAdd === 0) {
|
|
2438
2074
|
return this;
|
|
2439
2075
|
}
|
|
2440
|
-
|
|
2441
2076
|
var newYear = MathUtil.safeToInt(MathUtil.safeAdd(this._year, yearsToAdd));
|
|
2442
2077
|
return this.withYear(newYear);
|
|
2443
2078
|
};
|
|
2444
|
-
|
|
2445
2079
|
_proto.plusWeeks = function plusWeeks(weeksToAdd) {
|
|
2446
2080
|
if (weeksToAdd === 0) {
|
|
2447
2081
|
return this;
|
|
2448
2082
|
}
|
|
2449
|
-
|
|
2450
2083
|
var mondayOfWeek = this.atDay(core.DayOfWeek.MONDAY).plusWeeks(weeksToAdd);
|
|
2451
2084
|
return YearWeek.from(mondayOfWeek);
|
|
2452
2085
|
};
|
|
2453
|
-
|
|
2454
2086
|
_proto._minusUnit = function _minusUnit(amountToSubtract, unit) {
|
|
2455
2087
|
requireNonNull(amountToSubtract, 'amountToSubtract');
|
|
2456
2088
|
requireNonNull(unit, 'unit');
|
|
2457
2089
|
return this._plusUnit(-amountToSubtract, unit);
|
|
2458
2090
|
};
|
|
2459
|
-
|
|
2460
2091
|
_proto.minusYears = function minusYears(yearsToSubtract) {
|
|
2461
2092
|
if (yearsToSubtract === 0) {
|
|
2462
2093
|
return this;
|
|
2463
2094
|
}
|
|
2464
|
-
|
|
2465
2095
|
var newYear = MathUtil.safeToInt(MathUtil.safeSubtract(this._year, yearsToSubtract));
|
|
2466
2096
|
return this.withYear(newYear);
|
|
2467
2097
|
};
|
|
2468
|
-
|
|
2469
2098
|
_proto.minusWeeks = function minusWeeks(weeksToSubtract) {
|
|
2470
2099
|
if (weeksToSubtract === 0) {
|
|
2471
2100
|
return this;
|
|
2472
2101
|
}
|
|
2473
|
-
|
|
2474
2102
|
var mondayOfWeek = this.atDay(core.DayOfWeek.MONDAY).minusWeeks(weeksToSubtract);
|
|
2475
2103
|
return YearWeek.from(mondayOfWeek);
|
|
2476
2104
|
};
|
|
2477
|
-
|
|
2478
2105
|
_proto.query = function query(_query) {
|
|
2479
2106
|
requireNonNull(_query, 'query');
|
|
2480
2107
|
requireInstance(_query, core.TemporalQuery, 'query');
|
|
2481
|
-
|
|
2482
2108
|
if (_query === core.TemporalQueries.chronology()) {
|
|
2483
2109
|
return core.IsoChronology.INSTANCE;
|
|
2484
2110
|
}
|
|
2485
|
-
|
|
2486
2111
|
return _Temporal.prototype.query.call(this, _query);
|
|
2487
2112
|
};
|
|
2488
|
-
|
|
2489
2113
|
_proto.adjustInto = function adjustInto(temporal) {
|
|
2490
2114
|
return temporal.with(core.IsoFields.WEEK_BASED_YEAR, this._year).with(core.IsoFields.WEEK_OF_WEEK_BASED_YEAR, this._week);
|
|
2491
2115
|
};
|
|
2492
|
-
|
|
2493
2116
|
_proto.until = function until(endExclusive, unit) {
|
|
2494
2117
|
var end = YearWeek.from(endExclusive);
|
|
2495
|
-
|
|
2496
2118
|
if (unit === core.ChronoUnit.WEEKS) {
|
|
2497
2119
|
return this._daysUntil(end);
|
|
2498
2120
|
} else if (unit === core.IsoFields.WEEK_BASED_YEARS) {
|
|
@@ -2500,46 +2122,36 @@
|
|
|
2500
2122
|
} else if (unit instanceof core.ChronoUnit) {
|
|
2501
2123
|
throw new core.UnsupportedTemporalTypeException("Unsupported unit: " + unit);
|
|
2502
2124
|
}
|
|
2503
|
-
|
|
2504
2125
|
return unit.between(this, end);
|
|
2505
2126
|
};
|
|
2506
|
-
|
|
2507
2127
|
_proto._daysUntil = function _daysUntil(end) {
|
|
2508
2128
|
var startDate = this.atDay(core.DayOfWeek.MONDAY);
|
|
2509
2129
|
var endDate = end.atDay(core.DayOfWeek.MONDAY);
|
|
2510
2130
|
var days = endDate.toEpochDay() - startDate.toEpochDay();
|
|
2511
2131
|
return MathUtil.intDiv(days, 7);
|
|
2512
2132
|
};
|
|
2513
|
-
|
|
2514
2133
|
_proto._yearsUntil = function _yearsUntil(end) {
|
|
2515
2134
|
var yearsDiff = end._year - this._year;
|
|
2516
|
-
|
|
2517
2135
|
if (yearsDiff > 0 && end._week < this._week) {
|
|
2518
2136
|
return yearsDiff - 1;
|
|
2519
2137
|
}
|
|
2520
|
-
|
|
2521
2138
|
if (yearsDiff < 0 && end._week > this._week) {
|
|
2522
2139
|
return yearsDiff + 1;
|
|
2523
2140
|
}
|
|
2524
|
-
|
|
2525
2141
|
return yearsDiff;
|
|
2526
2142
|
};
|
|
2527
|
-
|
|
2528
2143
|
_proto.format = function format(formatter) {
|
|
2529
2144
|
requireNonNull(formatter, 'formatter');
|
|
2530
2145
|
return formatter.format(this);
|
|
2531
2146
|
};
|
|
2532
|
-
|
|
2533
2147
|
_proto.atDay = function atDay(dayOfWeek) {
|
|
2534
2148
|
requireNonNull(dayOfWeek, 'dayOfWeek');
|
|
2535
2149
|
var correction = core.LocalDate.of(this._year, 1, 4).dayOfWeek().value() + 3;
|
|
2536
2150
|
var dayOfYear = this._week * 7 + dayOfWeek.value() - correction;
|
|
2537
2151
|
var maxDaysOfYear = core.Year.isLeap(this._year) ? 366 : 365;
|
|
2538
|
-
|
|
2539
2152
|
if (dayOfYear > maxDaysOfYear) {
|
|
2540
2153
|
return core.LocalDate.ofYearDay(this._year + 1, dayOfYear - maxDaysOfYear);
|
|
2541
2154
|
}
|
|
2542
|
-
|
|
2543
2155
|
if (dayOfYear > 0) {
|
|
2544
2156
|
return core.LocalDate.ofYearDay(this._year, dayOfYear);
|
|
2545
2157
|
} else {
|
|
@@ -2547,48 +2159,37 @@
|
|
|
2547
2159
|
return core.LocalDate.ofYearDay(this._year - 1, daysOfPreviousYear + dayOfYear);
|
|
2548
2160
|
}
|
|
2549
2161
|
};
|
|
2550
|
-
|
|
2551
2162
|
_proto.compareTo = function compareTo(other) {
|
|
2552
2163
|
requireNonNull(other, 'other');
|
|
2553
2164
|
requireInstance(other, YearWeek, 'other');
|
|
2554
2165
|
var cmp = this._year - other._year;
|
|
2555
|
-
|
|
2556
2166
|
if (cmp === 0) {
|
|
2557
2167
|
cmp = this._week - other._week;
|
|
2558
2168
|
}
|
|
2559
|
-
|
|
2560
2169
|
return cmp;
|
|
2561
2170
|
};
|
|
2562
|
-
|
|
2563
2171
|
_proto.isAfter = function isAfter(other) {
|
|
2564
2172
|
return this.compareTo(other) > 0;
|
|
2565
2173
|
};
|
|
2566
|
-
|
|
2567
2174
|
_proto.isBefore = function isBefore(other) {
|
|
2568
2175
|
return this.compareTo(other) < 0;
|
|
2569
2176
|
};
|
|
2570
|
-
|
|
2571
2177
|
_proto.equals = function equals(obj) {
|
|
2572
2178
|
if (this === obj) {
|
|
2573
2179
|
return true;
|
|
2574
2180
|
}
|
|
2575
|
-
|
|
2576
2181
|
if (obj instanceof YearWeek) {
|
|
2577
2182
|
return this._year === obj._year && this._week === obj._week;
|
|
2578
2183
|
}
|
|
2579
|
-
|
|
2580
2184
|
return false;
|
|
2581
2185
|
};
|
|
2582
|
-
|
|
2583
2186
|
_proto.hashCode = function hashCode() {
|
|
2584
2187
|
return this._year ^ this._week << 25;
|
|
2585
2188
|
};
|
|
2586
|
-
|
|
2587
2189
|
_proto.toString = function toString() {
|
|
2588
2190
|
var yearString;
|
|
2589
2191
|
var yearValue = this._year;
|
|
2590
2192
|
var absYear = Math.abs(yearValue);
|
|
2591
|
-
|
|
2592
2193
|
if (absYear < 1000) {
|
|
2593
2194
|
if (yearValue < 0) {
|
|
2594
2195
|
yearString = "-" + ("" + (yearValue - 10000)).slice(-4);
|
|
@@ -2602,10 +2203,8 @@
|
|
|
2602
2203
|
yearString = "" + yearValue;
|
|
2603
2204
|
}
|
|
2604
2205
|
}
|
|
2605
|
-
|
|
2606
2206
|
return yearString.concat(this._week < 10 ? '-W0' : '-W').concat(this._week);
|
|
2607
2207
|
};
|
|
2608
|
-
|
|
2609
2208
|
return YearWeek;
|
|
2610
2209
|
}(core.Temporal);
|
|
2611
2210
|
function _init() {
|
|
@@ -2614,18 +2213,14 @@
|
|
|
2614
2213
|
return YearWeek.from(temporal);
|
|
2615
2214
|
});
|
|
2616
2215
|
}
|
|
2617
|
-
|
|
2618
2216
|
function createTemporalQuery(name, queryFromFunction) {
|
|
2619
2217
|
var ExtendedTemporalQuery = function (_TemporalQuery) {
|
|
2620
2218
|
_inheritsLoose(ExtendedTemporalQuery, _TemporalQuery);
|
|
2621
|
-
|
|
2622
2219
|
function ExtendedTemporalQuery() {
|
|
2623
2220
|
return _TemporalQuery.apply(this, arguments) || this;
|
|
2624
2221
|
}
|
|
2625
|
-
|
|
2626
2222
|
return ExtendedTemporalQuery;
|
|
2627
2223
|
}(core.TemporalQuery);
|
|
2628
|
-
|
|
2629
2224
|
ExtendedTemporalQuery.prototype.queryFrom = queryFromFunction;
|
|
2630
2225
|
return new ExtendedTemporalQuery(name);
|
|
2631
2226
|
}
|
|
@@ -2635,13 +2230,12 @@
|
|
|
2635
2230
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
2636
2231
|
*/
|
|
2637
2232
|
var isInit = false;
|
|
2638
|
-
|
|
2639
2233
|
function init() {
|
|
2640
2234
|
if (isInit) {
|
|
2641
2235
|
return;
|
|
2642
2236
|
}
|
|
2643
|
-
|
|
2644
2237
|
isInit = true;
|
|
2238
|
+
_init$8();
|
|
2645
2239
|
_init$7();
|
|
2646
2240
|
_init$6();
|
|
2647
2241
|
_init$5();
|
|
@@ -2651,13 +2245,8 @@
|
|
|
2651
2245
|
_init$1();
|
|
2652
2246
|
_init();
|
|
2653
2247
|
}
|
|
2654
|
-
|
|
2655
2248
|
init();
|
|
2656
2249
|
|
|
2657
|
-
/*
|
|
2658
|
-
* @copyright (c) 2016, Philipp Thuerwaechter & Pattrick Hueper
|
|
2659
|
-
* @license BSD-3-Clause (see LICENSE.md in the root directory of this source tree)
|
|
2660
|
-
*/
|
|
2661
2250
|
function plug () {}
|
|
2662
2251
|
|
|
2663
2252
|
/*
|
|
@@ -2672,10 +2261,9 @@
|
|
|
2672
2261
|
exports.LocalDateRange = LocalDateRange;
|
|
2673
2262
|
exports.OffsetDate = OffsetDate;
|
|
2674
2263
|
exports.Quarter = Quarter;
|
|
2264
|
+
exports.Temporals = Temporals;
|
|
2675
2265
|
exports.YearQuarter = YearQuarter;
|
|
2676
2266
|
exports.YearWeek = YearWeek;
|
|
2677
2267
|
|
|
2678
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2679
|
-
|
|
2680
2268
|
}));
|
|
2681
2269
|
//# sourceMappingURL=js-joda-extra.js.map
|