@js-joda/core 6.1.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/js-joda.js CHANGED
@@ -1,4 +1,4 @@
1
- //! @version @js-joda/core - 6.1.0
1
+ //! @version @js-joda/core - 6.2.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)
@@ -668,10 +668,15 @@
668
668
  if (divisor === 1) {
669
669
  return this;
670
670
  }
671
- var secs = MathUtil.intDiv(this._seconds, divisor);
672
- var secsMod = MathUtil.roundDown((this._seconds / divisor - secs) * LocalTime.NANOS_PER_SECOND);
673
- var nos = MathUtil.intDiv(this._nanos, divisor);
674
- nos = secsMod + nos;
671
+ var seconds = this._seconds;
672
+ var nanos = this._nanos;
673
+ if (seconds < 0 && nanos > 0) {
674
+ seconds += 1;
675
+ nanos -= LocalTime.NANOS_PER_SECOND;
676
+ }
677
+ var secs = MathUtil.intDiv(seconds, divisor);
678
+ var remainder = MathUtil.intMod(seconds, divisor);
679
+ var nos = MathUtil.intDiv(remainder * LocalTime.NANOS_PER_SECOND + nanos, divisor);
675
680
  return Duration.ofSeconds(secs, nos);
676
681
  };
677
682
  _proto.negated = function negated() {
@@ -2068,1411 +2073,1426 @@
2068
2073
  return ChronoLocalDate;
2069
2074
  }(Temporal);
2070
2075
 
2071
- /*
2072
- * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
2073
- * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
2074
- */
2075
-
2076
- var StringUtil = function () {
2077
- function StringUtil() {}
2078
- StringUtil.startsWith = function startsWith(text, pattern) {
2079
- return text.indexOf(pattern) === 0;
2076
+ var IsoFields = {};
2077
+ var QUARTER_DAYS = [0, 90, 181, 273, 0, 91, 182, 274];
2078
+ var Field = function (_TemporalField) {
2079
+ function Field() {
2080
+ return _TemporalField.apply(this, arguments) || this;
2081
+ }
2082
+ _inheritsLoose(Field, _TemporalField);
2083
+ var _proto = Field.prototype;
2084
+ _proto.isDateBased = function isDateBased() {
2085
+ return true;
2080
2086
  };
2081
- StringUtil.hashCode = function hashCode(text) {
2082
- var len = text.length;
2083
- if (len === 0) {
2084
- return 0;
2087
+ _proto.isTimeBased = function isTimeBased() {
2088
+ return false;
2089
+ };
2090
+ _proto._isIso = function _isIso() {
2091
+ return true;
2092
+ };
2093
+ Field._getWeekRangeByLocalDate = function _getWeekRangeByLocalDate(date) {
2094
+ var wby = Field._getWeekBasedYear(date);
2095
+ return ValueRange.of(1, Field._getWeekRangeByYear(wby));
2096
+ };
2097
+ Field._getWeekRangeByYear = function _getWeekRangeByYear(wby) {
2098
+ var date = LocalDate.of(wby, 1, 1);
2099
+ if (date.dayOfWeek() === DayOfWeek.THURSDAY || date.dayOfWeek() === DayOfWeek.WEDNESDAY && date.isLeapYear()) {
2100
+ return 53;
2085
2101
  }
2086
- var hash = 0;
2087
- for (var i = 0; i < len; i++) {
2088
- var chr = text.charCodeAt(i);
2089
- hash = (hash << 5) - hash + chr;
2090
- hash |= 0;
2102
+ return 52;
2103
+ };
2104
+ Field._getWeek = function _getWeek(date) {
2105
+ var dow0 = date.dayOfWeek().ordinal();
2106
+ var doy0 = date.dayOfYear() - 1;
2107
+ var doyThu0 = doy0 + (3 - dow0);
2108
+ var alignedWeek = MathUtil.intDiv(doyThu0, 7);
2109
+ var firstThuDoy0 = doyThu0 - alignedWeek * 7;
2110
+ var firstMonDoy0 = firstThuDoy0 - 3;
2111
+ if (firstMonDoy0 < -3) {
2112
+ firstMonDoy0 += 7;
2091
2113
  }
2092
- return MathUtil.smi(hash);
2114
+ if (doy0 < firstMonDoy0) {
2115
+ return Field._getWeekRangeByLocalDate(date.withDayOfYear(180).minusYears(1)).maximum();
2116
+ }
2117
+ var week = MathUtil.intDiv(doy0 - firstMonDoy0, 7) + 1;
2118
+ if (week === 53) {
2119
+ if ((firstMonDoy0 === -3 || firstMonDoy0 === -2 && date.isLeapYear()) === false) {
2120
+ week = 1;
2121
+ }
2122
+ }
2123
+ return week;
2093
2124
  };
2094
- return StringUtil;
2095
- }();
2096
-
2097
- /*
2098
- * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
2099
- * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
2100
- * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
2101
- */
2102
-
2103
- var ZoneId = function () {
2104
- function ZoneId() {}
2105
- ZoneId.systemDefault = function systemDefault() {
2106
- throw new DateTimeException('not supported operation');
2125
+ Field._getWeekBasedYear = function _getWeekBasedYear(date) {
2126
+ var year = date.year();
2127
+ var doy = date.dayOfYear();
2128
+ if (doy <= 3) {
2129
+ var dow = date.dayOfWeek().ordinal();
2130
+ if (doy - dow < -2) {
2131
+ year--;
2132
+ }
2133
+ } else if (doy >= 363) {
2134
+ var _dow = date.dayOfWeek().ordinal();
2135
+ doy = doy - 363 - (date.isLeapYear() ? 1 : 0);
2136
+ if (doy - _dow >= 0) {
2137
+ year++;
2138
+ }
2139
+ }
2140
+ return year;
2107
2141
  };
2108
- ZoneId.getAvailableZoneIds = function getAvailableZoneIds() {
2109
- throw new DateTimeException('not supported operation');
2142
+ _proto.displayName = function displayName() {
2143
+ return this.toString();
2110
2144
  };
2111
- ZoneId.of = function of(zoneId) {
2112
- throw new DateTimeException("not supported operation" + zoneId);
2145
+ _proto.resolve = function resolve() {
2146
+ return null;
2113
2147
  };
2114
- ZoneId.ofOffset = function ofOffset(prefix, offset) {
2115
- throw new DateTimeException("not supported operation" + prefix + offset);
2148
+ _proto.name = function name() {
2149
+ return this.toString();
2116
2150
  };
2117
- ZoneId.from = function from(temporal) {
2118
- throw new DateTimeException("not supported operation" + temporal);
2151
+ return Field;
2152
+ }(TemporalField);
2153
+ var DAY_OF_QUARTER_FIELD = function (_Field) {
2154
+ function DAY_OF_QUARTER_FIELD() {
2155
+ return _Field.apply(this, arguments) || this;
2156
+ }
2157
+ _inheritsLoose(DAY_OF_QUARTER_FIELD, _Field);
2158
+ var _proto2 = DAY_OF_QUARTER_FIELD.prototype;
2159
+ _proto2.toString = function toString() {
2160
+ return 'DayOfQuarter';
2119
2161
  };
2120
- var _proto = ZoneId.prototype;
2121
- _proto.id = function id() {
2122
- abstractMethodFail('ZoneId.id');
2162
+ _proto2.baseUnit = function baseUnit() {
2163
+ return ChronoUnit.DAYS;
2123
2164
  };
2124
- _proto.rules = function rules() {
2125
- abstractMethodFail('ZoneId.rules');
2165
+ _proto2.rangeUnit = function rangeUnit() {
2166
+ return QUARTER_YEARS;
2126
2167
  };
2127
- _proto.normalized = function normalized() {
2128
- var rules = this.rules();
2129
- if (rules.isFixedOffset()) {
2130
- return rules.offset(Instant.EPOCH);
2131
- }
2132
- return this;
2168
+ _proto2.range = function range() {
2169
+ return ValueRange.of(1, 90, 92);
2133
2170
  };
2134
- _proto.equals = function equals(other) {
2135
- if (this === other) {
2136
- return true;
2171
+ _proto2.isSupportedBy = function isSupportedBy(temporal) {
2172
+ return temporal.isSupported(ChronoField.DAY_OF_YEAR) && temporal.isSupported(ChronoField.MONTH_OF_YEAR) && temporal.isSupported(ChronoField.YEAR) && this._isIso(temporal);
2173
+ };
2174
+ _proto2.rangeRefinedBy = function rangeRefinedBy(temporal) {
2175
+ if (temporal.isSupported(this) === false) {
2176
+ throw new UnsupportedTemporalTypeException('Unsupported field: DayOfQuarter');
2137
2177
  }
2138
- if (other instanceof ZoneId) {
2139
- return this.id() === other.id();
2178
+ var qoy = temporal.getLong(QUARTER_OF_YEAR);
2179
+ if (qoy === 1) {
2180
+ var year = temporal.getLong(ChronoField.YEAR);
2181
+ return IsoChronology.isLeapYear(year) ? ValueRange.of(1, 91) : ValueRange.of(1, 90);
2182
+ } else if (qoy === 2) {
2183
+ return ValueRange.of(1, 91);
2184
+ } else if (qoy === 3 || qoy === 4) {
2185
+ return ValueRange.of(1, 92);
2140
2186
  }
2141
- return false;
2142
- };
2143
- _proto.hashCode = function hashCode() {
2144
- return StringUtil.hashCode(this.id());
2145
- };
2146
- _proto.toString = function toString() {
2147
- return this.id();
2148
- };
2149
- _proto.toJSON = function toJSON() {
2150
- return this.toString();
2187
+ return this.range();
2151
2188
  };
2152
- return ZoneId;
2153
- }();
2154
-
2155
- var ZoneRules = function () {
2156
- function ZoneRules() {}
2157
- ZoneRules.of = function of(offset) {
2158
- requireNonNull(offset, 'offset');
2159
- return new Fixed(offset);
2189
+ _proto2.getFrom = function getFrom(temporal) {
2190
+ if (temporal.isSupported(this) === false) {
2191
+ throw new UnsupportedTemporalTypeException('Unsupported field: DayOfQuarter');
2192
+ }
2193
+ var doy = temporal.get(ChronoField.DAY_OF_YEAR);
2194
+ var moy = temporal.get(ChronoField.MONTH_OF_YEAR);
2195
+ var year = temporal.getLong(ChronoField.YEAR);
2196
+ return doy - QUARTER_DAYS[MathUtil.intDiv(moy - 1, 3) + (IsoChronology.isLeapYear(year) ? 4 : 0)];
2160
2197
  };
2161
- var _proto = ZoneRules.prototype;
2162
- _proto.isFixedOffset = function isFixedOffset() {
2163
- abstractMethodFail('ZoneRules.isFixedOffset');
2198
+ _proto2.adjustInto = function adjustInto(temporal, newValue) {
2199
+ var curValue = this.getFrom(temporal);
2200
+ this.range().checkValidValue(newValue, this);
2201
+ return temporal.with(ChronoField.DAY_OF_YEAR, temporal.getLong(ChronoField.DAY_OF_YEAR) + (newValue - curValue));
2164
2202
  };
2165
- _proto.offset = function offset(instantOrLocalDateTime) {
2166
- if (instantOrLocalDateTime instanceof Instant) {
2167
- return this.offsetOfInstant(instantOrLocalDateTime);
2203
+ _proto2.resolve = function resolve(fieldValues, partialTemporal, resolverStyle) {
2204
+ var yearLong = fieldValues.get(ChronoField.YEAR);
2205
+ var qoyLong = fieldValues.get(QUARTER_OF_YEAR);
2206
+ if (yearLong == null || qoyLong == null) {
2207
+ return null;
2208
+ }
2209
+ var y = ChronoField.YEAR.checkValidIntValue(yearLong);
2210
+ var doq = fieldValues.get(DAY_OF_QUARTER);
2211
+ var date;
2212
+ if (resolverStyle === ResolverStyle.LENIENT) {
2213
+ var qoy = qoyLong;
2214
+ date = LocalDate.of(y, 1, 1);
2215
+ date = date.plusMonths(MathUtil.safeMultiply(MathUtil.safeSubtract(qoy, 1), 3));
2216
+ date = date.plusDays(MathUtil.safeSubtract(doq, 1));
2168
2217
  } else {
2169
- return this.offsetOfLocalDateTime(instantOrLocalDateTime);
2218
+ var _qoy = QUARTER_OF_YEAR.range().checkValidIntValue(qoyLong, QUARTER_OF_YEAR);
2219
+ if (resolverStyle === ResolverStyle.STRICT) {
2220
+ var max = 92;
2221
+ if (_qoy === 1) {
2222
+ max = IsoChronology.isLeapYear(y) ? 91 : 90;
2223
+ } else if (_qoy === 2) {
2224
+ max = 91;
2225
+ }
2226
+ ValueRange.of(1, max).checkValidValue(doq, this);
2227
+ } else {
2228
+ this.range().checkValidValue(doq, this);
2229
+ }
2230
+ date = LocalDate.of(y, (_qoy - 1) * 3 + 1, 1).plusDays(doq - 1);
2170
2231
  }
2232
+ fieldValues.remove(this);
2233
+ fieldValues.remove(ChronoField.YEAR);
2234
+ fieldValues.remove(QUARTER_OF_YEAR);
2235
+ return date;
2171
2236
  };
2172
- _proto.offsetOfInstant = function offsetOfInstant(instant) {
2173
- abstractMethodFail('ZoneRules.offsetInstant');
2237
+ return DAY_OF_QUARTER_FIELD;
2238
+ }(Field);
2239
+ var QUARTER_OF_YEAR_FIELD = function (_Field2) {
2240
+ function QUARTER_OF_YEAR_FIELD() {
2241
+ return _Field2.apply(this, arguments) || this;
2242
+ }
2243
+ _inheritsLoose(QUARTER_OF_YEAR_FIELD, _Field2);
2244
+ var _proto3 = QUARTER_OF_YEAR_FIELD.prototype;
2245
+ _proto3.toString = function toString() {
2246
+ return 'QuarterOfYear';
2174
2247
  };
2175
- _proto.offsetOfEpochMilli = function offsetOfEpochMilli(epochMilli) {
2176
- abstractMethodFail('ZoneRules.offsetOfEpochMilli');
2248
+ _proto3.baseUnit = function baseUnit() {
2249
+ return QUARTER_YEARS;
2177
2250
  };
2178
- _proto.offsetOfLocalDateTime = function offsetOfLocalDateTime(localDateTime) {
2179
- abstractMethodFail('ZoneRules.offsetLocalDateTime');
2251
+ _proto3.rangeUnit = function rangeUnit() {
2252
+ return ChronoUnit.YEARS;
2180
2253
  };
2181
- _proto.validOffsets = function validOffsets(localDateTime) {
2182
- abstractMethodFail('ZoneRules.validOffsets');
2254
+ _proto3.range = function range() {
2255
+ return ValueRange.of(1, 4);
2183
2256
  };
2184
- _proto.transition = function transition(localDateTime) {
2185
- abstractMethodFail('ZoneRules.transition');
2257
+ _proto3.isSupportedBy = function isSupportedBy(temporal) {
2258
+ return temporal.isSupported(ChronoField.MONTH_OF_YEAR) && this._isIso(temporal);
2186
2259
  };
2187
- _proto.standardOffset = function standardOffset(instant) {
2188
- abstractMethodFail('ZoneRules.standardOffset');
2260
+ _proto3.rangeRefinedBy = function rangeRefinedBy(temporal) {
2261
+ return this.range();
2189
2262
  };
2190
- _proto.daylightSavings = function daylightSavings(instant) {
2191
- abstractMethodFail('ZoneRules.daylightSavings');
2192
- };
2193
- _proto.isDaylightSavings = function isDaylightSavings(instant) {
2194
- abstractMethodFail('ZoneRules.isDaylightSavings');
2195
- };
2196
- _proto.isValidOffset = function isValidOffset(localDateTime, offset) {
2197
- abstractMethodFail('ZoneRules.isValidOffset');
2198
- };
2199
- _proto.nextTransition = function nextTransition(instant) {
2200
- abstractMethodFail('ZoneRules.nextTransition');
2201
- };
2202
- _proto.previousTransition = function previousTransition(instant) {
2203
- abstractMethodFail('ZoneRules.previousTransition');
2263
+ _proto3.getFrom = function getFrom(temporal) {
2264
+ if (temporal.isSupported(this) === false) {
2265
+ throw new UnsupportedTemporalTypeException('Unsupported field: QuarterOfYear');
2266
+ }
2267
+ var moy = temporal.getLong(ChronoField.MONTH_OF_YEAR);
2268
+ return MathUtil.intDiv(moy + 2, 3);
2204
2269
  };
2205
- _proto.transitions = function transitions() {
2206
- abstractMethodFail('ZoneRules.transitions');
2270
+ _proto3.adjustInto = function adjustInto(temporal, newValue) {
2271
+ var curValue = this.getFrom(temporal);
2272
+ this.range().checkValidValue(newValue, this);
2273
+ return temporal.with(ChronoField.MONTH_OF_YEAR, temporal.getLong(ChronoField.MONTH_OF_YEAR) + (newValue - curValue) * 3);
2207
2274
  };
2208
- _proto.transitionRules = function transitionRules() {
2209
- abstractMethodFail('ZoneRules.transitionRules');
2275
+ return QUARTER_OF_YEAR_FIELD;
2276
+ }(Field);
2277
+ var WEEK_OF_WEEK_BASED_YEAR_FIELD = function (_Field3) {
2278
+ function WEEK_OF_WEEK_BASED_YEAR_FIELD() {
2279
+ return _Field3.apply(this, arguments) || this;
2280
+ }
2281
+ _inheritsLoose(WEEK_OF_WEEK_BASED_YEAR_FIELD, _Field3);
2282
+ var _proto4 = WEEK_OF_WEEK_BASED_YEAR_FIELD.prototype;
2283
+ _proto4.toString = function toString() {
2284
+ return 'WeekOfWeekBasedYear';
2210
2285
  };
2211
- _proto.toString = function toString() {
2212
- abstractMethodFail('ZoneRules.toString');
2286
+ _proto4.baseUnit = function baseUnit() {
2287
+ return ChronoUnit.WEEKS;
2213
2288
  };
2214
- _proto.toJSON = function toJSON() {
2215
- return this.toString();
2289
+ _proto4.rangeUnit = function rangeUnit() {
2290
+ return WEEK_BASED_YEARS;
2216
2291
  };
2217
- return ZoneRules;
2218
- }();
2219
- var Fixed = function (_ZoneRules) {
2220
- function Fixed(offset) {
2221
- var _this;
2222
- _this = _ZoneRules.call(this) || this;
2223
- _this._offset = offset;
2224
- return _this;
2225
- }
2226
- _inheritsLoose(Fixed, _ZoneRules);
2227
- var _proto2 = Fixed.prototype;
2228
- _proto2.isFixedOffset = function isFixedOffset() {
2229
- return true;
2292
+ _proto4.range = function range() {
2293
+ return ValueRange.of(1, 52, 53);
2230
2294
  };
2231
- _proto2.offsetOfInstant = function offsetOfInstant() {
2232
- return this._offset;
2295
+ _proto4.isSupportedBy = function isSupportedBy(temporal) {
2296
+ return temporal.isSupported(ChronoField.EPOCH_DAY) && this._isIso(temporal);
2233
2297
  };
2234
- _proto2.offsetOfEpochMilli = function offsetOfEpochMilli() {
2235
- return this._offset;
2298
+ _proto4.rangeRefinedBy = function rangeRefinedBy(temporal) {
2299
+ if (temporal.isSupported(this) === false) {
2300
+ throw new UnsupportedTemporalTypeException('Unsupported field: WeekOfWeekBasedYear');
2301
+ }
2302
+ return Field._getWeekRangeByLocalDate(LocalDate.from(temporal));
2236
2303
  };
2237
- _proto2.offsetOfLocalDateTime = function offsetOfLocalDateTime() {
2238
- return this._offset;
2304
+ _proto4.getFrom = function getFrom(temporal) {
2305
+ if (temporal.isSupported(this) === false) {
2306
+ throw new UnsupportedTemporalTypeException('Unsupported field: WeekOfWeekBasedYear');
2307
+ }
2308
+ return Field._getWeek(LocalDate.from(temporal));
2239
2309
  };
2240
- _proto2.validOffsets = function validOffsets() {
2241
- return [this._offset];
2310
+ _proto4.adjustInto = function adjustInto(temporal, newValue) {
2311
+ this.range().checkValidValue(newValue, this);
2312
+ return temporal.plus(MathUtil.safeSubtract(newValue, this.getFrom(temporal)), ChronoUnit.WEEKS);
2242
2313
  };
2243
- _proto2.transition = function transition() {
2244
- return null;
2314
+ _proto4.resolve = function resolve(fieldValues, partialTemporal, resolverStyle) {
2315
+ var wbyLong = fieldValues.get(WEEK_BASED_YEAR);
2316
+ var dowLong = fieldValues.get(ChronoField.DAY_OF_WEEK);
2317
+ if (wbyLong == null || dowLong == null) {
2318
+ return null;
2319
+ }
2320
+ var wby = WEEK_BASED_YEAR.range().checkValidIntValue(wbyLong, WEEK_BASED_YEAR);
2321
+ var wowby = fieldValues.get(WEEK_OF_WEEK_BASED_YEAR);
2322
+ var date;
2323
+ if (resolverStyle === ResolverStyle.LENIENT) {
2324
+ var dow = dowLong;
2325
+ var weeks = 0;
2326
+ if (dow > 7) {
2327
+ weeks = MathUtil.intDiv(dow - 1, 7);
2328
+ dow = MathUtil.intMod(dow - 1, 7) + 1;
2329
+ } else if (dow < 1) {
2330
+ weeks = MathUtil.intDiv(dow, 7) - 1;
2331
+ dow = MathUtil.intMod(dow, 7) + 7;
2332
+ }
2333
+ date = LocalDate.of(wby, 1, 4).plusWeeks(wowby - 1).plusWeeks(weeks).with(ChronoField.DAY_OF_WEEK, dow);
2334
+ } else {
2335
+ var _dow2 = ChronoField.DAY_OF_WEEK.checkValidIntValue(dowLong);
2336
+ if (resolverStyle === ResolverStyle.STRICT) {
2337
+ var temp = LocalDate.of(wby, 1, 4);
2338
+ var range = Field._getWeekRangeByLocalDate(temp);
2339
+ range.checkValidValue(wowby, this);
2340
+ } else {
2341
+ this.range().checkValidValue(wowby, this);
2342
+ }
2343
+ date = LocalDate.of(wby, 1, 4).plusWeeks(wowby - 1).with(ChronoField.DAY_OF_WEEK, _dow2);
2344
+ }
2345
+ fieldValues.remove(this);
2346
+ fieldValues.remove(WEEK_BASED_YEAR);
2347
+ fieldValues.remove(ChronoField.DAY_OF_WEEK);
2348
+ return date;
2245
2349
  };
2246
- _proto2.standardOffset = function standardOffset() {
2247
- return this._offset;
2350
+ _proto4.displayName = function displayName() {
2351
+ return 'Week';
2248
2352
  };
2249
- _proto2.daylightSavings = function daylightSavings() {
2250
- return Duration.ZERO;
2353
+ return WEEK_OF_WEEK_BASED_YEAR_FIELD;
2354
+ }(Field);
2355
+ var WEEK_BASED_YEAR_FIELD = function (_Field4) {
2356
+ function WEEK_BASED_YEAR_FIELD() {
2357
+ return _Field4.apply(this, arguments) || this;
2358
+ }
2359
+ _inheritsLoose(WEEK_BASED_YEAR_FIELD, _Field4);
2360
+ var _proto5 = WEEK_BASED_YEAR_FIELD.prototype;
2361
+ _proto5.toString = function toString() {
2362
+ return 'WeekBasedYear';
2251
2363
  };
2252
- _proto2.isDaylightSavings = function isDaylightSavings() {
2253
- return false;
2364
+ _proto5.baseUnit = function baseUnit() {
2365
+ return WEEK_BASED_YEARS;
2254
2366
  };
2255
- _proto2.isValidOffset = function isValidOffset(localDateTime, offset) {
2256
- return this._offset.equals(offset);
2367
+ _proto5.rangeUnit = function rangeUnit() {
2368
+ return ChronoUnit.FOREVER;
2257
2369
  };
2258
- _proto2.nextTransition = function nextTransition() {
2259
- return null;
2370
+ _proto5.range = function range() {
2371
+ return ChronoField.YEAR.range();
2260
2372
  };
2261
- _proto2.previousTransition = function previousTransition() {
2262
- return null;
2373
+ _proto5.isSupportedBy = function isSupportedBy(temporal) {
2374
+ return temporal.isSupported(ChronoField.EPOCH_DAY) && this._isIso(temporal);
2263
2375
  };
2264
- _proto2.transitions = function transitions() {
2265
- return [];
2376
+ _proto5.rangeRefinedBy = function rangeRefinedBy(temporal) {
2377
+ return ChronoField.YEAR.range();
2266
2378
  };
2267
- _proto2.transitionRules = function transitionRules() {
2268
- return [];
2379
+ _proto5.getFrom = function getFrom(temporal) {
2380
+ if (temporal.isSupported(this) === false) {
2381
+ throw new UnsupportedTemporalTypeException('Unsupported field: WeekBasedYear');
2382
+ }
2383
+ return Field._getWeekBasedYear(LocalDate.from(temporal));
2269
2384
  };
2270
- _proto2.equals = function equals(other) {
2271
- if (this === other) {
2272
- return true;
2385
+ _proto5.adjustInto = function adjustInto(temporal, newValue) {
2386
+ if (this.isSupportedBy(temporal) === false) {
2387
+ throw new UnsupportedTemporalTypeException('Unsupported field: WeekBasedYear');
2273
2388
  }
2274
- if (other instanceof Fixed) {
2275
- return this._offset.equals(other._offset);
2389
+ var newWby = this.range().checkValidIntValue(newValue, WEEK_BASED_YEAR);
2390
+ var date = LocalDate.from(temporal);
2391
+ var dow = date.get(ChronoField.DAY_OF_WEEK);
2392
+ var week = Field._getWeek(date);
2393
+ if (week === 53 && Field._getWeekRangeByYear(newWby) === 52) {
2394
+ week = 52;
2276
2395
  }
2277
- return false;
2278
- };
2279
- _proto2.toString = function toString() {
2280
- return "FixedRules:" + this._offset.toString();
2396
+ var resolved = LocalDate.of(newWby, 1, 4);
2397
+ var days = dow - resolved.get(ChronoField.DAY_OF_WEEK) + (week - 1) * 7;
2398
+ resolved = resolved.plusDays(days);
2399
+ return temporal.with(resolved);
2281
2400
  };
2282
- return Fixed;
2283
- }(ZoneRules);
2284
-
2285
- var SECONDS_CACHE = {};
2286
- var ID_CACHE = {};
2287
- var ZoneOffset = function (_ZoneId) {
2288
- function ZoneOffset(totalSeconds) {
2401
+ return WEEK_BASED_YEAR_FIELD;
2402
+ }(Field);
2403
+ var Unit = function (_TemporalUnit) {
2404
+ function Unit(name, estimatedDuration) {
2289
2405
  var _this;
2290
- _this = _ZoneId.call(this) || this;
2291
- ZoneOffset._validateTotalSeconds(totalSeconds);
2292
- _this._totalSeconds = MathUtil.safeToInt(totalSeconds);
2293
- _this._rules = ZoneRules.of(_this);
2294
- _this._id = ZoneOffset._buildId(totalSeconds);
2406
+ _this = _TemporalUnit.call(this) || this;
2407
+ _this._name = name;
2408
+ _this._duration = estimatedDuration;
2295
2409
  return _this;
2296
2410
  }
2297
- _inheritsLoose(ZoneOffset, _ZoneId);
2298
- var _proto = ZoneOffset.prototype;
2299
- _proto.totalSeconds = function totalSeconds() {
2300
- return this._totalSeconds;
2411
+ _inheritsLoose(Unit, _TemporalUnit);
2412
+ var _proto6 = Unit.prototype;
2413
+ _proto6.duration = function duration() {
2414
+ return this._duration;
2301
2415
  };
2302
- _proto.id = function id() {
2303
- return this._id;
2416
+ _proto6.isDurationEstimated = function isDurationEstimated() {
2417
+ return true;
2304
2418
  };
2305
- ZoneOffset._buildId = function _buildId(totalSeconds) {
2306
- if (totalSeconds === 0) {
2307
- return 'Z';
2308
- } else {
2309
- var absTotalSeconds = Math.abs(totalSeconds);
2310
- var absHours = MathUtil.intDiv(absTotalSeconds, LocalTime.SECONDS_PER_HOUR);
2311
- var absMinutes = MathUtil.intMod(MathUtil.intDiv(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE), LocalTime.MINUTES_PER_HOUR);
2312
- var buf = "" + (totalSeconds < 0 ? '-' : '+') + (absHours < 10 ? '0' : '') + absHours + (absMinutes < 10 ? ':0' : ':') + absMinutes;
2313
- var absSeconds = MathUtil.intMod(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE);
2314
- if (absSeconds !== 0) {
2315
- buf += (absSeconds < 10 ? ':0' : ':') + absSeconds;
2316
- }
2317
- return buf;
2318
- }
2419
+ _proto6.isDateBased = function isDateBased() {
2420
+ return true;
2319
2421
  };
2320
- ZoneOffset._validateTotalSeconds = function _validateTotalSeconds(totalSeconds) {
2321
- if (Math.abs(totalSeconds) > ZoneOffset.MAX_SECONDS) {
2322
- throw new DateTimeException('Zone offset not in valid range: -18:00 to +18:00');
2323
- }
2422
+ _proto6.isTimeBased = function isTimeBased() {
2423
+ return false;
2324
2424
  };
2325
- ZoneOffset._validate = function _validate(hours, minutes, seconds) {
2326
- if (hours < -18 || hours > 18) {
2327
- throw new DateTimeException("Zone offset hours not in valid range: value " + hours + " is not in the range -18 to 18");
2328
- }
2329
- if (hours > 0) {
2330
- if (minutes < 0 || seconds < 0) {
2331
- throw new DateTimeException('Zone offset minutes and seconds must be positive because hours is positive');
2332
- }
2333
- } else if (hours < 0) {
2334
- if (minutes > 0 || seconds > 0) {
2335
- throw new DateTimeException('Zone offset minutes and seconds must be negative because hours is negative');
2336
- }
2337
- } else if (minutes > 0 && seconds < 0 || minutes < 0 && seconds > 0) {
2338
- throw new DateTimeException('Zone offset minutes and seconds must have the same sign');
2339
- }
2340
- if (Math.abs(minutes) > 59) {
2341
- throw new DateTimeException("Zone offset minutes not in valid range: abs(value) " + Math.abs(minutes) + " is not in the range 0 to 59");
2342
- }
2343
- if (Math.abs(seconds) > 59) {
2344
- throw new DateTimeException("Zone offset seconds not in valid range: abs(value) " + Math.abs(seconds) + " is not in the range 0 to 59");
2345
- }
2346
- if (Math.abs(hours) === 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) {
2347
- throw new DateTimeException('Zone offset not in valid range: -18:00 to +18:00');
2425
+ _proto6.isSupportedBy = function isSupportedBy(temporal) {
2426
+ return temporal.isSupported(ChronoField.EPOCH_DAY);
2427
+ };
2428
+ _proto6.addTo = function addTo(temporal, periodToAdd) {
2429
+ switch (this) {
2430
+ case WEEK_BASED_YEARS:
2431
+ {
2432
+ var added = MathUtil.safeAdd(temporal.get(WEEK_BASED_YEAR), periodToAdd);
2433
+ return temporal.with(WEEK_BASED_YEAR, added);
2434
+ }
2435
+ case QUARTER_YEARS:
2436
+ return temporal.plus(MathUtil.intDiv(periodToAdd, 256), ChronoUnit.YEARS).plus(MathUtil.intMod(periodToAdd, 256) * 3, ChronoUnit.MONTHS);
2437
+ default:
2438
+ throw new IllegalStateException('Unreachable');
2348
2439
  }
2349
2440
  };
2350
- ZoneOffset.of = function of(offsetId) {
2351
- requireNonNull(offsetId, 'offsetId');
2352
- var offset = ID_CACHE[offsetId];
2353
- if (offset != null) {
2354
- return offset;
2355
- }
2356
- var hours, minutes, seconds;
2357
- switch (offsetId.length) {
2358
- case 2:
2359
- offsetId = offsetId[0] + "0" + offsetId[1];
2360
- case 3:
2361
- hours = ZoneOffset._parseNumber(offsetId, 1, false);
2362
- minutes = 0;
2363
- seconds = 0;
2364
- break;
2365
- case 5:
2366
- hours = ZoneOffset._parseNumber(offsetId, 1, false);
2367
- minutes = ZoneOffset._parseNumber(offsetId, 3, false);
2368
- seconds = 0;
2369
- break;
2370
- case 6:
2371
- hours = ZoneOffset._parseNumber(offsetId, 1, false);
2372
- minutes = ZoneOffset._parseNumber(offsetId, 4, true);
2373
- seconds = 0;
2374
- break;
2375
- case 7:
2376
- hours = ZoneOffset._parseNumber(offsetId, 1, false);
2377
- minutes = ZoneOffset._parseNumber(offsetId, 3, false);
2378
- seconds = ZoneOffset._parseNumber(offsetId, 5, false);
2379
- break;
2380
- case 9:
2381
- hours = ZoneOffset._parseNumber(offsetId, 1, false);
2382
- minutes = ZoneOffset._parseNumber(offsetId, 4, true);
2383
- seconds = ZoneOffset._parseNumber(offsetId, 7, true);
2384
- break;
2441
+ _proto6.between = function between(temporal1, temporal2) {
2442
+ switch (this) {
2443
+ case WEEK_BASED_YEARS:
2444
+ return MathUtil.safeSubtract(temporal2.getLong(WEEK_BASED_YEAR), temporal1.getLong(WEEK_BASED_YEAR));
2445
+ case QUARTER_YEARS:
2446
+ return MathUtil.intDiv(temporal1.until(temporal2, ChronoUnit.MONTHS), 3);
2385
2447
  default:
2386
- throw new DateTimeException("Invalid ID for ZoneOffset, invalid format: " + offsetId);
2387
- }
2388
- var first = offsetId[0];
2389
- if (first !== '+' && first !== '-') {
2390
- throw new DateTimeException("Invalid ID for ZoneOffset, plus/minus not found when expected: " + offsetId);
2391
- }
2392
- if (first === '-') {
2393
- return ZoneOffset.ofHoursMinutesSeconds(-hours, -minutes, -seconds);
2394
- } else {
2395
- return ZoneOffset.ofHoursMinutesSeconds(hours, minutes, seconds);
2396
- }
2397
- };
2398
- ZoneOffset._parseNumber = function _parseNumber(offsetId, pos, precededByColon) {
2399
- if (precededByColon && offsetId[pos - 1] !== ':') {
2400
- throw new DateTimeException("Invalid ID for ZoneOffset, colon not found when expected: " + offsetId);
2401
- }
2402
- var ch1 = offsetId[pos];
2403
- var ch2 = offsetId[pos + 1];
2404
- if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') {
2405
- throw new DateTimeException("Invalid ID for ZoneOffset, non numeric characters found: " + offsetId);
2448
+ throw new IllegalStateException('Unreachable');
2406
2449
  }
2407
- return (ch1.charCodeAt(0) - 48) * 10 + (ch2.charCodeAt(0) - 48);
2408
2450
  };
2409
- ZoneOffset.ofHours = function ofHours(hours) {
2410
- return ZoneOffset.ofHoursMinutesSeconds(hours, 0, 0);
2451
+ _proto6.toString = function toString() {
2452
+ return this._name;
2411
2453
  };
2412
- ZoneOffset.ofHoursMinutes = function ofHoursMinutes(hours, minutes) {
2413
- return ZoneOffset.ofHoursMinutesSeconds(hours, minutes, 0);
2454
+ return Unit;
2455
+ }(TemporalUnit);
2456
+ var DAY_OF_QUARTER = null;
2457
+ var QUARTER_OF_YEAR = null;
2458
+ var WEEK_OF_WEEK_BASED_YEAR = null;
2459
+ var WEEK_BASED_YEAR = null;
2460
+ var WEEK_BASED_YEARS = null;
2461
+ var QUARTER_YEARS = null;
2462
+ function _init$g() {
2463
+ DAY_OF_QUARTER = new DAY_OF_QUARTER_FIELD();
2464
+ QUARTER_OF_YEAR = new QUARTER_OF_YEAR_FIELD();
2465
+ WEEK_OF_WEEK_BASED_YEAR = new WEEK_OF_WEEK_BASED_YEAR_FIELD();
2466
+ WEEK_BASED_YEAR = new WEEK_BASED_YEAR_FIELD();
2467
+ WEEK_BASED_YEARS = new Unit('WeekBasedYears', Duration.ofSeconds(31556952));
2468
+ QUARTER_YEARS = new Unit('QuarterYears', Duration.ofSeconds(31556952 / 4));
2469
+ IsoFields.DAY_OF_QUARTER = DAY_OF_QUARTER;
2470
+ IsoFields.QUARTER_OF_YEAR = QUARTER_OF_YEAR;
2471
+ IsoFields.WEEK_OF_WEEK_BASED_YEAR = WEEK_OF_WEEK_BASED_YEAR;
2472
+ IsoFields.WEEK_BASED_YEAR = WEEK_BASED_YEAR;
2473
+ IsoFields.WEEK_BASED_YEARS = WEEK_BASED_YEARS;
2474
+ IsoFields.QUARTER_YEARS = QUARTER_YEARS;
2475
+ LocalDate.prototype.isoWeekOfWeekyear = function () {
2476
+ return this.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR);
2414
2477
  };
2415
- ZoneOffset.ofHoursMinutesSeconds = function ofHoursMinutesSeconds(hours, minutes, seconds) {
2416
- ZoneOffset._validate(hours, minutes, seconds);
2417
- var totalSeconds = hours * LocalTime.SECONDS_PER_HOUR + minutes * LocalTime.SECONDS_PER_MINUTE + seconds;
2418
- return ZoneOffset.ofTotalSeconds(totalSeconds);
2478
+ LocalDate.prototype.isoWeekyear = function () {
2479
+ return this.get(IsoFields.WEEK_BASED_YEAR);
2419
2480
  };
2420
- ZoneOffset.ofTotalMinutes = function ofTotalMinutes(totalMinutes) {
2421
- var totalSeconds = totalMinutes * LocalTime.SECONDS_PER_MINUTE;
2422
- return ZoneOffset.ofTotalSeconds(totalSeconds);
2481
+ }
2482
+
2483
+ /*
2484
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
2485
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
2486
+ */
2487
+
2488
+ var StringUtil = function () {
2489
+ function StringUtil() {}
2490
+ StringUtil.startsWith = function startsWith(text, pattern) {
2491
+ return text.indexOf(pattern) === 0;
2423
2492
  };
2424
- ZoneOffset.ofTotalSeconds = function ofTotalSeconds(totalSeconds) {
2425
- if (totalSeconds % (15 * LocalTime.SECONDS_PER_MINUTE) === 0) {
2426
- var totalSecs = totalSeconds;
2427
- var result = SECONDS_CACHE[totalSecs];
2428
- if (result == null) {
2429
- result = new ZoneOffset(totalSeconds);
2430
- SECONDS_CACHE[totalSecs] = result;
2431
- ID_CACHE[result.id()] = result;
2432
- }
2433
- return result;
2434
- } else {
2435
- return new ZoneOffset(totalSeconds);
2493
+ StringUtil.hashCode = function hashCode(text) {
2494
+ var len = text.length;
2495
+ if (len === 0) {
2496
+ return 0;
2497
+ }
2498
+ var hash = 0;
2499
+ for (var i = 0; i < len; i++) {
2500
+ var chr = text.charCodeAt(i);
2501
+ hash = (hash << 5) - hash + chr;
2502
+ hash |= 0;
2436
2503
  }
2504
+ return MathUtil.smi(hash);
2437
2505
  };
2438
- _proto.rules = function rules() {
2439
- return this._rules;
2506
+ return StringUtil;
2507
+ }();
2508
+
2509
+ /*
2510
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
2511
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
2512
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
2513
+ */
2514
+
2515
+ var ZoneId = function () {
2516
+ function ZoneId() {}
2517
+ ZoneId.systemDefault = function systemDefault() {
2518
+ throw new DateTimeException('not supported operation');
2440
2519
  };
2441
- _proto.get = function get(field) {
2442
- return this.getLong(field);
2520
+ ZoneId.getAvailableZoneIds = function getAvailableZoneIds() {
2521
+ throw new DateTimeException('not supported operation');
2443
2522
  };
2444
- _proto.getLong = function getLong(field) {
2445
- if (field === ChronoField.OFFSET_SECONDS) {
2446
- return this._totalSeconds;
2447
- } else if (field instanceof ChronoField) {
2448
- throw new DateTimeException("Unsupported field: " + field);
2449
- }
2450
- return field.getFrom(this);
2523
+ ZoneId.of = function of(zoneId) {
2524
+ throw new DateTimeException("not supported operation" + zoneId);
2451
2525
  };
2452
- _proto.query = function query(_query) {
2453
- requireNonNull(_query, 'query');
2454
- if (_query === TemporalQueries.offset() || _query === TemporalQueries.zone()) {
2455
- return this;
2456
- } else if (_query === TemporalQueries.localDate() || _query === TemporalQueries.localTime() || _query === TemporalQueries.precision() || _query === TemporalQueries.chronology() || _query === TemporalQueries.zoneId()) {
2457
- return null;
2458
- }
2459
- return _query.queryFrom(this);
2526
+ ZoneId.ofOffset = function ofOffset(prefix, offset) {
2527
+ throw new DateTimeException("not supported operation" + prefix + offset);
2460
2528
  };
2461
- _proto.adjustInto = function adjustInto(temporal) {
2462
- return temporal.with(ChronoField.OFFSET_SECONDS, this._totalSeconds);
2529
+ ZoneId.from = function from(temporal) {
2530
+ throw new DateTimeException("not supported operation" + temporal);
2463
2531
  };
2464
- _proto.compareTo = function compareTo(other) {
2465
- requireNonNull(other, 'other');
2466
- return other._totalSeconds - this._totalSeconds;
2532
+ var _proto = ZoneId.prototype;
2533
+ _proto.id = function id() {
2534
+ abstractMethodFail('ZoneId.id');
2467
2535
  };
2468
- _proto.equals = function equals(obj) {
2469
- if (this === obj) {
2536
+ _proto.rules = function rules() {
2537
+ abstractMethodFail('ZoneId.rules');
2538
+ };
2539
+ _proto.normalized = function normalized() {
2540
+ var rules = this.rules();
2541
+ if (rules.isFixedOffset()) {
2542
+ return rules.offset(Instant.EPOCH);
2543
+ }
2544
+ return this;
2545
+ };
2546
+ _proto.equals = function equals(other) {
2547
+ if (this === other) {
2470
2548
  return true;
2471
2549
  }
2472
- if (obj instanceof ZoneOffset) {
2473
- return this._totalSeconds === obj._totalSeconds;
2550
+ if (other instanceof ZoneId) {
2551
+ return this.id() === other.id();
2474
2552
  }
2475
2553
  return false;
2476
2554
  };
2477
2555
  _proto.hashCode = function hashCode() {
2478
- return this._totalSeconds;
2556
+ return StringUtil.hashCode(this.id());
2479
2557
  };
2480
2558
  _proto.toString = function toString() {
2481
- return this._id;
2559
+ return this.id();
2482
2560
  };
2483
- return ZoneOffset;
2484
- }(ZoneId);
2485
- function _init$g() {
2486
- ZoneOffset.MAX_SECONDS = 18 * LocalTime.SECONDS_PER_HOUR;
2487
- ZoneOffset.UTC = ZoneOffset.ofTotalSeconds(0);
2488
- ZoneOffset.MIN = ZoneOffset.ofTotalSeconds(-ZoneOffset.MAX_SECONDS);
2489
- ZoneOffset.MAX = ZoneOffset.ofTotalSeconds(ZoneOffset.MAX_SECONDS);
2490
- }
2491
-
2492
- var DateTimeBuilder = function (_TemporalAccessor) {
2493
- function DateTimeBuilder() {
2494
- var _this;
2495
- _this = _TemporalAccessor.call(this) || this;
2496
- _this.fieldValues = new EnumMap();
2497
- _this.chrono = null;
2498
- _this.zone = null;
2499
- _this.date = null;
2500
- _this.time = null;
2501
- _this.leapSecond = false;
2502
- _this.excessDays = null;
2503
- return _this;
2504
- }
2505
- _inheritsLoose(DateTimeBuilder, _TemporalAccessor);
2506
- DateTimeBuilder.create = function create(field, value) {
2507
- var dtb = new DateTimeBuilder();
2508
- dtb._addFieldValue(field, value);
2509
- return dtb;
2561
+ _proto.toJSON = function toJSON() {
2562
+ return this.toString();
2510
2563
  };
2511
- var _proto = DateTimeBuilder.prototype;
2512
- _proto.getFieldValue0 = function getFieldValue0(field) {
2513
- return this.fieldValues.get(field);
2564
+ return ZoneId;
2565
+ }();
2566
+
2567
+ var ZoneRules = function () {
2568
+ function ZoneRules() {}
2569
+ ZoneRules.of = function of(offset) {
2570
+ requireNonNull(offset, 'offset');
2571
+ return new Fixed(offset);
2514
2572
  };
2515
- _proto._addFieldValue = function _addFieldValue(field, value) {
2516
- requireNonNull(field, 'field');
2517
- var old = this.getFieldValue0(field);
2518
- if (old != null && old !== value) {
2519
- throw new DateTimeException("Conflict found: " + field + " " + old + " differs from " + field + " " + value + ": " + this);
2573
+ var _proto = ZoneRules.prototype;
2574
+ _proto.isFixedOffset = function isFixedOffset() {
2575
+ abstractMethodFail('ZoneRules.isFixedOffset');
2576
+ };
2577
+ _proto.offset = function offset(instantOrLocalDateTime) {
2578
+ if (instantOrLocalDateTime instanceof Instant) {
2579
+ return this.offsetOfInstant(instantOrLocalDateTime);
2580
+ } else {
2581
+ return this.offsetOfLocalDateTime(instantOrLocalDateTime);
2520
2582
  }
2521
- return this._putFieldValue0(field, value);
2522
2583
  };
2523
- _proto._putFieldValue0 = function _putFieldValue0(field, value) {
2524
- this.fieldValues.put(field, value);
2525
- return this;
2584
+ _proto.offsetOfInstant = function offsetOfInstant(instant) {
2585
+ abstractMethodFail('ZoneRules.offsetInstant');
2526
2586
  };
2527
- _proto.resolve = function resolve(resolverStyle, resolverFields) {
2528
- if (resolverFields != null) {
2529
- this.fieldValues.retainAll(resolverFields);
2587
+ _proto.offsetOfEpochMilli = function offsetOfEpochMilli(epochMilli) {
2588
+ abstractMethodFail('ZoneRules.offsetOfEpochMilli');
2589
+ };
2590
+ _proto.offsetOfLocalDateTime = function offsetOfLocalDateTime(localDateTime) {
2591
+ abstractMethodFail('ZoneRules.offsetLocalDateTime');
2592
+ };
2593
+ _proto.validOffsets = function validOffsets(localDateTime) {
2594
+ abstractMethodFail('ZoneRules.validOffsets');
2595
+ };
2596
+ _proto.transition = function transition(localDateTime) {
2597
+ abstractMethodFail('ZoneRules.transition');
2598
+ };
2599
+ _proto.standardOffset = function standardOffset(instant) {
2600
+ abstractMethodFail('ZoneRules.standardOffset');
2601
+ };
2602
+ _proto.daylightSavings = function daylightSavings(instant) {
2603
+ abstractMethodFail('ZoneRules.daylightSavings');
2604
+ };
2605
+ _proto.isDaylightSavings = function isDaylightSavings(instant) {
2606
+ abstractMethodFail('ZoneRules.isDaylightSavings');
2607
+ };
2608
+ _proto.isValidOffset = function isValidOffset(localDateTime, offset) {
2609
+ abstractMethodFail('ZoneRules.isValidOffset');
2610
+ };
2611
+ _proto.nextTransition = function nextTransition(instant) {
2612
+ abstractMethodFail('ZoneRules.nextTransition');
2613
+ };
2614
+ _proto.previousTransition = function previousTransition(instant) {
2615
+ abstractMethodFail('ZoneRules.previousTransition');
2616
+ };
2617
+ _proto.transitions = function transitions() {
2618
+ abstractMethodFail('ZoneRules.transitions');
2619
+ };
2620
+ _proto.transitionRules = function transitionRules() {
2621
+ abstractMethodFail('ZoneRules.transitionRules');
2622
+ };
2623
+ _proto.toString = function toString() {
2624
+ abstractMethodFail('ZoneRules.toString');
2625
+ };
2626
+ _proto.toJSON = function toJSON() {
2627
+ return this.toString();
2628
+ };
2629
+ return ZoneRules;
2630
+ }();
2631
+ var Fixed = function (_ZoneRules) {
2632
+ function Fixed(offset) {
2633
+ var _this;
2634
+ _this = _ZoneRules.call(this) || this;
2635
+ _this._offset = offset;
2636
+ return _this;
2637
+ }
2638
+ _inheritsLoose(Fixed, _ZoneRules);
2639
+ var _proto2 = Fixed.prototype;
2640
+ _proto2.isFixedOffset = function isFixedOffset() {
2641
+ return true;
2642
+ };
2643
+ _proto2.offsetOfInstant = function offsetOfInstant() {
2644
+ return this._offset;
2645
+ };
2646
+ _proto2.offsetOfEpochMilli = function offsetOfEpochMilli() {
2647
+ return this._offset;
2648
+ };
2649
+ _proto2.offsetOfLocalDateTime = function offsetOfLocalDateTime() {
2650
+ return this._offset;
2651
+ };
2652
+ _proto2.validOffsets = function validOffsets() {
2653
+ return [this._offset];
2654
+ };
2655
+ _proto2.transition = function transition() {
2656
+ return null;
2657
+ };
2658
+ _proto2.standardOffset = function standardOffset() {
2659
+ return this._offset;
2660
+ };
2661
+ _proto2.daylightSavings = function daylightSavings() {
2662
+ return Duration.ZERO;
2663
+ };
2664
+ _proto2.isDaylightSavings = function isDaylightSavings() {
2665
+ return false;
2666
+ };
2667
+ _proto2.isValidOffset = function isValidOffset(localDateTime, offset) {
2668
+ return this._offset.equals(offset);
2669
+ };
2670
+ _proto2.nextTransition = function nextTransition() {
2671
+ return null;
2672
+ };
2673
+ _proto2.previousTransition = function previousTransition() {
2674
+ return null;
2675
+ };
2676
+ _proto2.transitions = function transitions() {
2677
+ return [];
2678
+ };
2679
+ _proto2.transitionRules = function transitionRules() {
2680
+ return [];
2681
+ };
2682
+ _proto2.equals = function equals(other) {
2683
+ if (this === other) {
2684
+ return true;
2530
2685
  }
2531
- this._mergeDate(resolverStyle);
2532
- this._mergeTime(resolverStyle);
2533
- this._resolveTimeInferZeroes(resolverStyle);
2534
- if (this.excessDays != null && this.excessDays.isZero() === false && this.date != null && this.time != null) {
2535
- this.date = this.date.plus(this.excessDays);
2536
- this.excessDays = Period.ZERO;
2686
+ if (other instanceof Fixed) {
2687
+ return this._offset.equals(other._offset);
2537
2688
  }
2538
- this._resolveInstant();
2539
- return this;
2689
+ return false;
2540
2690
  };
2541
- _proto._mergeDate = function _mergeDate(resolverStyle) {
2542
- this._checkDate(IsoChronology.INSTANCE.resolveDate(this.fieldValues, resolverStyle));
2691
+ _proto2.toString = function toString() {
2692
+ return "FixedRules:" + this._offset.toString();
2543
2693
  };
2544
- _proto._checkDate = function _checkDate(date) {
2545
- if (date != null) {
2546
- this._addObject(date);
2547
- for (var fieldName in this.fieldValues.keySet()) {
2548
- var field = ChronoField.byName(fieldName);
2549
- if (field) {
2550
- if (this.fieldValues.get(field) !== undefined) {
2551
- if (field.isDateBased()) {
2552
- var val1 = void 0;
2553
- try {
2554
- val1 = date.getLong(field);
2555
- } catch (ex) {
2556
- if (ex instanceof DateTimeException) {
2557
- continue;
2558
- } else {
2559
- throw ex;
2560
- }
2561
- }
2562
- var val2 = this.fieldValues.get(field);
2563
- if (val1 !== val2) {
2564
- throw new DateTimeException("Conflict found: Field " + field + " " + val1 + " differs from " + field + " " + val2 + " derived from " + date);
2565
- }
2566
- }
2567
- }
2568
- }
2694
+ return Fixed;
2695
+ }(ZoneRules);
2696
+
2697
+ var SECONDS_CACHE = {};
2698
+ var ID_CACHE = {};
2699
+ var ZoneOffset = function (_ZoneId) {
2700
+ function ZoneOffset(totalSeconds) {
2701
+ var _this;
2702
+ _this = _ZoneId.call(this) || this;
2703
+ ZoneOffset._validateTotalSeconds(totalSeconds);
2704
+ _this._totalSeconds = MathUtil.safeToInt(totalSeconds);
2705
+ _this._rules = ZoneRules.of(_this);
2706
+ _this._id = ZoneOffset._buildId(totalSeconds);
2707
+ return _this;
2708
+ }
2709
+ _inheritsLoose(ZoneOffset, _ZoneId);
2710
+ var _proto = ZoneOffset.prototype;
2711
+ _proto.totalSeconds = function totalSeconds() {
2712
+ return this._totalSeconds;
2713
+ };
2714
+ _proto.id = function id() {
2715
+ return this._id;
2716
+ };
2717
+ ZoneOffset._buildId = function _buildId(totalSeconds) {
2718
+ if (totalSeconds === 0) {
2719
+ return 'Z';
2720
+ } else {
2721
+ var absTotalSeconds = Math.abs(totalSeconds);
2722
+ var absHours = MathUtil.intDiv(absTotalSeconds, LocalTime.SECONDS_PER_HOUR);
2723
+ var absMinutes = MathUtil.intMod(MathUtil.intDiv(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE), LocalTime.MINUTES_PER_HOUR);
2724
+ var buf = "" + (totalSeconds < 0 ? '-' : '+') + (absHours < 10 ? '0' : '') + absHours + (absMinutes < 10 ? ':0' : ':') + absMinutes;
2725
+ var absSeconds = MathUtil.intMod(absTotalSeconds, LocalTime.SECONDS_PER_MINUTE);
2726
+ if (absSeconds !== 0) {
2727
+ buf += (absSeconds < 10 ? ':0' : ':') + absSeconds;
2569
2728
  }
2729
+ return buf;
2570
2730
  }
2571
2731
  };
2572
- _proto._mergeTime = function _mergeTime(resolverStyle) {
2573
- if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_DAY)) {
2574
- var ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_DAY);
2575
- if (resolverStyle !== ResolverStyle.LENIENT) {
2576
- if (resolverStyle === ResolverStyle.SMART && ch === 0) ; else {
2577
- ChronoField.CLOCK_HOUR_OF_DAY.checkValidValue(ch);
2578
- }
2579
- }
2580
- this._addFieldValue(ChronoField.HOUR_OF_DAY, ch === 24 ? 0 : ch);
2732
+ ZoneOffset._validateTotalSeconds = function _validateTotalSeconds(totalSeconds) {
2733
+ if (Math.abs(totalSeconds) > ZoneOffset.MAX_SECONDS) {
2734
+ throw new DateTimeException('Zone offset not in valid range: -18:00 to +18:00');
2581
2735
  }
2582
- if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_AMPM)) {
2583
- var _ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_AMPM);
2584
- if (resolverStyle !== ResolverStyle.LENIENT) {
2585
- if (resolverStyle === ResolverStyle.SMART && _ch === 0) ; else {
2586
- ChronoField.CLOCK_HOUR_OF_AMPM.checkValidValue(_ch);
2587
- }
2588
- }
2589
- this._addFieldValue(ChronoField.HOUR_OF_AMPM, _ch === 12 ? 0 : _ch);
2736
+ };
2737
+ ZoneOffset._validate = function _validate(hours, minutes, seconds) {
2738
+ if (hours < -18 || hours > 18) {
2739
+ throw new DateTimeException("Zone offset hours not in valid range: value " + hours + " is not in the range -18 to 18");
2590
2740
  }
2591
- if (resolverStyle !== ResolverStyle.LENIENT) {
2592
- if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY)) {
2593
- ChronoField.AMPM_OF_DAY.checkValidValue(this.fieldValues.get(ChronoField.AMPM_OF_DAY));
2741
+ if (hours > 0) {
2742
+ if (minutes < 0 || seconds < 0) {
2743
+ throw new DateTimeException('Zone offset minutes and seconds must be positive because hours is positive');
2594
2744
  }
2595
- if (this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
2596
- ChronoField.HOUR_OF_AMPM.checkValidValue(this.fieldValues.get(ChronoField.HOUR_OF_AMPM));
2745
+ } else if (hours < 0) {
2746
+ if (minutes > 0 || seconds > 0) {
2747
+ throw new DateTimeException('Zone offset minutes and seconds must be negative because hours is negative');
2597
2748
  }
2749
+ } else if (minutes > 0 && seconds < 0 || minutes < 0 && seconds > 0) {
2750
+ throw new DateTimeException('Zone offset minutes and seconds must have the same sign');
2598
2751
  }
2599
- if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY) && this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
2600
- var ap = this.fieldValues.remove(ChronoField.AMPM_OF_DAY);
2601
- var hap = this.fieldValues.remove(ChronoField.HOUR_OF_AMPM);
2602
- this._addFieldValue(ChronoField.HOUR_OF_DAY, ap * 12 + hap);
2752
+ if (Math.abs(minutes) > 59) {
2753
+ throw new DateTimeException("Zone offset minutes not in valid range: abs(value) " + Math.abs(minutes) + " is not in the range 0 to 59");
2603
2754
  }
2604
- if (this.fieldValues.containsKey(ChronoField.NANO_OF_DAY)) {
2605
- var nod = this.fieldValues.remove(ChronoField.NANO_OF_DAY);
2606
- if (resolverStyle !== ResolverStyle.LENIENT) {
2607
- ChronoField.NANO_OF_DAY.checkValidValue(nod);
2608
- }
2609
- this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(nod, 1000000000));
2610
- this._addFieldValue(ChronoField.NANO_OF_SECOND, MathUtil.intMod(nod, 1000000000));
2755
+ if (Math.abs(seconds) > 59) {
2756
+ throw new DateTimeException("Zone offset seconds not in valid range: abs(value) " + Math.abs(seconds) + " is not in the range 0 to 59");
2611
2757
  }
2612
- if (this.fieldValues.containsKey(ChronoField.MICRO_OF_DAY)) {
2613
- var cod = this.fieldValues.remove(ChronoField.MICRO_OF_DAY);
2614
- if (resolverStyle !== ResolverStyle.LENIENT) {
2615
- ChronoField.MICRO_OF_DAY.checkValidValue(cod);
2616
- }
2617
- this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(cod, 1000000));
2618
- this._addFieldValue(ChronoField.MICRO_OF_SECOND, MathUtil.intMod(cod, 1000000));
2619
- }
2620
- if (this.fieldValues.containsKey(ChronoField.MILLI_OF_DAY)) {
2621
- var lod = this.fieldValues.remove(ChronoField.MILLI_OF_DAY);
2622
- if (resolverStyle !== ResolverStyle.LENIENT) {
2623
- ChronoField.MILLI_OF_DAY.checkValidValue(lod);
2624
- }
2625
- this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(lod, 1000));
2626
- this._addFieldValue(ChronoField.MILLI_OF_SECOND, MathUtil.intMod(lod, 1000));
2627
- }
2628
- if (this.fieldValues.containsKey(ChronoField.SECOND_OF_DAY)) {
2629
- var sod = this.fieldValues.remove(ChronoField.SECOND_OF_DAY);
2630
- if (resolverStyle !== ResolverStyle.LENIENT) {
2631
- ChronoField.SECOND_OF_DAY.checkValidValue(sod);
2632
- }
2633
- this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(sod, 3600));
2634
- this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(MathUtil.intDiv(sod, 60), 60));
2635
- this._addFieldValue(ChronoField.SECOND_OF_MINUTE, MathUtil.intMod(sod, 60));
2636
- }
2637
- if (this.fieldValues.containsKey(ChronoField.MINUTE_OF_DAY)) {
2638
- var mod = this.fieldValues.remove(ChronoField.MINUTE_OF_DAY);
2639
- if (resolverStyle !== ResolverStyle.LENIENT) {
2640
- ChronoField.MINUTE_OF_DAY.checkValidValue(mod);
2641
- }
2642
- this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(mod, 60));
2643
- this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(mod, 60));
2644
- }
2645
- if (resolverStyle !== ResolverStyle.LENIENT) {
2646
- if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
2647
- ChronoField.MILLI_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MILLI_OF_SECOND));
2648
- }
2649
- if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
2650
- ChronoField.MICRO_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MICRO_OF_SECOND));
2651
- }
2652
- }
2653
- if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
2654
- var los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
2655
- var cos = this.fieldValues.get(ChronoField.MICRO_OF_SECOND);
2656
- this._putFieldValue0(ChronoField.MICRO_OF_SECOND, los * 1000 + MathUtil.intMod(cos, 1000));
2657
- }
2658
- if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
2659
- var nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
2660
- this._putFieldValue0(ChronoField.MICRO_OF_SECOND, MathUtil.intDiv(nos, 1000));
2661
- this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
2662
- }
2663
- if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
2664
- var _nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
2665
- this._putFieldValue0(ChronoField.MILLI_OF_SECOND, MathUtil.intDiv(_nos, 1000000));
2666
- this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
2667
- }
2668
- if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
2669
- var _cos = this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
2670
- this._putFieldValue0(ChronoField.NANO_OF_SECOND, _cos * 1000);
2671
- } else if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
2672
- var _los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
2673
- this._putFieldValue0(ChronoField.NANO_OF_SECOND, _los * 1000000);
2758
+ if (Math.abs(hours) === 18 && (Math.abs(minutes) > 0 || Math.abs(seconds) > 0)) {
2759
+ throw new DateTimeException('Zone offset not in valid range: -18:00 to +18:00');
2674
2760
  }
2675
2761
  };
2676
- _proto._resolveTimeInferZeroes = function _resolveTimeInferZeroes(resolverStyle) {
2677
- var hod = this.fieldValues.get(ChronoField.HOUR_OF_DAY);
2678
- var moh = this.fieldValues.get(ChronoField.MINUTE_OF_HOUR);
2679
- var som = this.fieldValues.get(ChronoField.SECOND_OF_MINUTE);
2680
- var nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
2681
- if (hod == null) {
2682
- return;
2762
+ ZoneOffset.of = function of(offsetId) {
2763
+ requireNonNull(offsetId, 'offsetId');
2764
+ var offset = ID_CACHE[offsetId];
2765
+ if (offset != null) {
2766
+ return offset;
2683
2767
  }
2684
- if (moh == null && (som != null || nos != null)) {
2685
- return;
2768
+ var hours, minutes, seconds;
2769
+ switch (offsetId.length) {
2770
+ case 2:
2771
+ offsetId = offsetId[0] + "0" + offsetId[1];
2772
+ case 3:
2773
+ hours = ZoneOffset._parseNumber(offsetId, 1, false);
2774
+ minutes = 0;
2775
+ seconds = 0;
2776
+ break;
2777
+ case 5:
2778
+ hours = ZoneOffset._parseNumber(offsetId, 1, false);
2779
+ minutes = ZoneOffset._parseNumber(offsetId, 3, false);
2780
+ seconds = 0;
2781
+ break;
2782
+ case 6:
2783
+ hours = ZoneOffset._parseNumber(offsetId, 1, false);
2784
+ minutes = ZoneOffset._parseNumber(offsetId, 4, true);
2785
+ seconds = 0;
2786
+ break;
2787
+ case 7:
2788
+ hours = ZoneOffset._parseNumber(offsetId, 1, false);
2789
+ minutes = ZoneOffset._parseNumber(offsetId, 3, false);
2790
+ seconds = ZoneOffset._parseNumber(offsetId, 5, false);
2791
+ break;
2792
+ case 9:
2793
+ hours = ZoneOffset._parseNumber(offsetId, 1, false);
2794
+ minutes = ZoneOffset._parseNumber(offsetId, 4, true);
2795
+ seconds = ZoneOffset._parseNumber(offsetId, 7, true);
2796
+ break;
2797
+ default:
2798
+ throw new DateTimeException("Invalid ID for ZoneOffset, invalid format: " + offsetId);
2686
2799
  }
2687
- if (moh != null && som == null && nos != null) {
2688
- return;
2800
+ var first = offsetId[0];
2801
+ if (first !== '+' && first !== '-') {
2802
+ throw new DateTimeException("Invalid ID for ZoneOffset, plus/minus not found when expected: " + offsetId);
2689
2803
  }
2690
- if (resolverStyle !== ResolverStyle.LENIENT) {
2691
- if (hod != null) {
2692
- if (resolverStyle === ResolverStyle.SMART && hod === 24 && (moh == null || moh === 0) && (som == null || som === 0) && (nos == null || nos === 0)) {
2693
- hod = 0;
2694
- this.excessDays = Period.ofDays(1);
2695
- }
2696
- var hodVal = ChronoField.HOUR_OF_DAY.checkValidIntValue(hod);
2697
- if (moh != null) {
2698
- var mohVal = ChronoField.MINUTE_OF_HOUR.checkValidIntValue(moh);
2699
- if (som != null) {
2700
- var somVal = ChronoField.SECOND_OF_MINUTE.checkValidIntValue(som);
2701
- if (nos != null) {
2702
- var nosVal = ChronoField.NANO_OF_SECOND.checkValidIntValue(nos);
2703
- this._addObject(LocalTime.of(hodVal, mohVal, somVal, nosVal));
2704
- } else {
2705
- this._addObject(LocalTime.of(hodVal, mohVal, somVal));
2706
- }
2707
- } else {
2708
- if (nos == null) {
2709
- this._addObject(LocalTime.of(hodVal, mohVal));
2710
- }
2711
- }
2712
- } else {
2713
- if (som == null && nos == null) {
2714
- this._addObject(LocalTime.of(hodVal, 0));
2715
- }
2716
- }
2717
- }
2804
+ if (first === '-') {
2805
+ return ZoneOffset.ofHoursMinutesSeconds(-hours, -minutes, -seconds);
2718
2806
  } else {
2719
- if (hod != null) {
2720
- var _hodVal = hod;
2721
- if (moh != null) {
2722
- if (som != null) {
2723
- if (nos == null) {
2724
- nos = 0;
2725
- }
2726
- var totalNanos = MathUtil.safeMultiply(_hodVal, 3600000000000);
2727
- totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(moh, 60000000000));
2728
- totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(som, 1000000000));
2729
- totalNanos = MathUtil.safeAdd(totalNanos, nos);
2730
- var excessDays = MathUtil.floorDiv(totalNanos, 86400000000000);
2731
- var nod = MathUtil.floorMod(totalNanos, 86400000000000);
2732
- this._addObject(LocalTime.ofNanoOfDay(nod));
2733
- this.excessDays = Period.ofDays(excessDays);
2734
- } else {
2735
- var totalSecs = MathUtil.safeMultiply(_hodVal, 3600);
2736
- totalSecs = MathUtil.safeAdd(totalSecs, MathUtil.safeMultiply(moh, 60));
2737
- var _excessDays = MathUtil.floorDiv(totalSecs, 86400);
2738
- var sod = MathUtil.floorMod(totalSecs, 86400);
2739
- this._addObject(LocalTime.ofSecondOfDay(sod));
2740
- this.excessDays = Period.ofDays(_excessDays);
2741
- }
2742
- } else {
2743
- var _excessDays2 = MathUtil.safeToInt(MathUtil.floorDiv(_hodVal, 24));
2744
- _hodVal = MathUtil.floorMod(_hodVal, 24);
2745
- this._addObject(LocalTime.of(_hodVal, 0));
2746
- this.excessDays = Period.ofDays(_excessDays2);
2747
- }
2748
- }
2807
+ return ZoneOffset.ofHoursMinutesSeconds(hours, minutes, seconds);
2749
2808
  }
2750
- this.fieldValues.remove(ChronoField.HOUR_OF_DAY);
2751
- this.fieldValues.remove(ChronoField.MINUTE_OF_HOUR);
2752
- this.fieldValues.remove(ChronoField.SECOND_OF_MINUTE);
2753
- this.fieldValues.remove(ChronoField.NANO_OF_SECOND);
2754
2809
  };
2755
- _proto._addObject = function _addObject(dateOrTime) {
2756
- if (dateOrTime instanceof ChronoLocalDate) {
2757
- this.date = dateOrTime;
2758
- } else if (dateOrTime instanceof LocalTime) {
2759
- this.time = dateOrTime;
2810
+ ZoneOffset._parseNumber = function _parseNumber(offsetId, pos, precededByColon) {
2811
+ if (precededByColon && offsetId[pos - 1] !== ':') {
2812
+ throw new DateTimeException("Invalid ID for ZoneOffset, colon not found when expected: " + offsetId);
2813
+ }
2814
+ var ch1 = offsetId[pos];
2815
+ var ch2 = offsetId[pos + 1];
2816
+ if (ch1 < '0' || ch1 > '9' || ch2 < '0' || ch2 > '9') {
2817
+ throw new DateTimeException("Invalid ID for ZoneOffset, non numeric characters found: " + offsetId);
2760
2818
  }
2819
+ return (ch1.charCodeAt(0) - 48) * 10 + (ch2.charCodeAt(0) - 48);
2761
2820
  };
2762
- _proto._resolveInstant = function _resolveInstant() {
2763
- if (this.date != null && this.time != null) {
2764
- var offsetSecs = this.fieldValues.get(ChronoField.OFFSET_SECONDS);
2765
- if (offsetSecs != null) {
2766
- var offset = ZoneOffset.ofTotalSeconds(offsetSecs);
2767
- var instant = this.date.atTime(this.time).atZone(offset).getLong(ChronoField.INSTANT_SECONDS);
2768
- this.fieldValues.put(ChronoField.INSTANT_SECONDS, instant);
2769
- } else if (this.zone != null) {
2770
- var _instant = this.date.atTime(this.time).atZone(this.zone).getLong(ChronoField.INSTANT_SECONDS);
2771
- this.fieldValues.put(ChronoField.INSTANT_SECONDS, _instant);
2821
+ ZoneOffset.ofHours = function ofHours(hours) {
2822
+ return ZoneOffset.ofHoursMinutesSeconds(hours, 0, 0);
2823
+ };
2824
+ ZoneOffset.ofHoursMinutes = function ofHoursMinutes(hours, minutes) {
2825
+ return ZoneOffset.ofHoursMinutesSeconds(hours, minutes, 0);
2826
+ };
2827
+ ZoneOffset.ofHoursMinutesSeconds = function ofHoursMinutesSeconds(hours, minutes, seconds) {
2828
+ ZoneOffset._validate(hours, minutes, seconds);
2829
+ var totalSeconds = hours * LocalTime.SECONDS_PER_HOUR + minutes * LocalTime.SECONDS_PER_MINUTE + seconds;
2830
+ return ZoneOffset.ofTotalSeconds(totalSeconds);
2831
+ };
2832
+ ZoneOffset.ofTotalMinutes = function ofTotalMinutes(totalMinutes) {
2833
+ var totalSeconds = totalMinutes * LocalTime.SECONDS_PER_MINUTE;
2834
+ return ZoneOffset.ofTotalSeconds(totalSeconds);
2835
+ };
2836
+ ZoneOffset.ofTotalSeconds = function ofTotalSeconds(totalSeconds) {
2837
+ if (totalSeconds % (15 * LocalTime.SECONDS_PER_MINUTE) === 0) {
2838
+ var totalSecs = totalSeconds;
2839
+ var result = SECONDS_CACHE[totalSecs];
2840
+ if (result == null) {
2841
+ result = new ZoneOffset(totalSeconds);
2842
+ SECONDS_CACHE[totalSecs] = result;
2843
+ ID_CACHE[result.id()] = result;
2772
2844
  }
2845
+ return result;
2846
+ } else {
2847
+ return new ZoneOffset(totalSeconds);
2773
2848
  }
2774
2849
  };
2775
- _proto.build = function build(type) {
2776
- return type.queryFrom(this);
2850
+ _proto.rules = function rules() {
2851
+ return this._rules;
2777
2852
  };
2778
- _proto.isSupported = function isSupported(field) {
2779
- if (field == null) {
2780
- return false;
2781
- }
2782
- return this.fieldValues.containsKey(field) && this.fieldValues.get(field) !== undefined || this.date != null && this.date.isSupported(field) || this.time != null && this.time.isSupported(field);
2853
+ _proto.get = function get(field) {
2854
+ return this.getLong(field);
2783
2855
  };
2784
2856
  _proto.getLong = function getLong(field) {
2785
- requireNonNull(field, 'field');
2786
- var value = this.getFieldValue0(field);
2787
- if (value == null) {
2788
- if (this.date != null && this.date.isSupported(field)) {
2789
- return this.date.getLong(field);
2790
- }
2791
- if (this.time != null && this.time.isSupported(field)) {
2792
- return this.time.getLong(field);
2793
- }
2794
- throw new DateTimeException("Field not found: " + field);
2857
+ if (field === ChronoField.OFFSET_SECONDS) {
2858
+ return this._totalSeconds;
2859
+ } else if (field instanceof ChronoField) {
2860
+ throw new DateTimeException("Unsupported field: " + field);
2795
2861
  }
2796
- return value;
2862
+ return field.getFrom(this);
2797
2863
  };
2798
2864
  _proto.query = function query(_query) {
2799
- if (_query === TemporalQueries.zoneId()) {
2800
- return this.zone;
2801
- } else if (_query === TemporalQueries.chronology()) {
2802
- return this.chrono;
2803
- } else if (_query === TemporalQueries.localDate()) {
2804
- return this.date != null ? LocalDate.from(this.date) : null;
2805
- } else if (_query === TemporalQueries.localTime()) {
2806
- return this.time;
2807
- } else if (_query === TemporalQueries.zone() || _query === TemporalQueries.offset()) {
2808
- return _query.queryFrom(this);
2809
- } else if (_query === TemporalQueries.precision()) {
2865
+ requireNonNull(_query, 'query');
2866
+ if (_query === TemporalQueries.offset() || _query === TemporalQueries.zone()) {
2867
+ return this;
2868
+ } else if (_query === TemporalQueries.localDate() || _query === TemporalQueries.localTime() || _query === TemporalQueries.precision() || _query === TemporalQueries.chronology() || _query === TemporalQueries.zoneId()) {
2810
2869
  return null;
2811
2870
  }
2812
2871
  return _query.queryFrom(this);
2813
2872
  };
2814
- return DateTimeBuilder;
2815
- }(TemporalAccessor);
2816
-
2817
- var DateTimeParseContext = function () {
2818
- function DateTimeParseContext() {
2819
- if (arguments.length === 1) {
2820
- if (arguments[0] instanceof DateTimeParseContext) {
2821
- this._constructorSelf.apply(this, arguments);
2822
- return;
2823
- } else {
2824
- this._constructorFormatter.apply(this, arguments);
2825
- }
2826
- } else {
2827
- this._constructorParam.apply(this, arguments);
2828
- }
2829
- this._caseSensitive = true;
2830
- this._strict = true;
2831
- this._parsed = [new Parsed(this)];
2832
- }
2833
- var _proto = DateTimeParseContext.prototype;
2834
- _proto._constructorParam = function _constructorParam(locale, symbols, chronology) {
2835
- this._locale = locale;
2836
- this._symbols = symbols;
2837
- this._overrideChronology = chronology;
2838
- };
2839
- _proto._constructorFormatter = function _constructorFormatter(formatter) {
2840
- this._locale = formatter.locale();
2841
- this._symbols = formatter.decimalStyle();
2842
- this._overrideChronology = formatter.chronology();
2843
- };
2844
- _proto._constructorSelf = function _constructorSelf(other) {
2845
- this._locale = other._locale;
2846
- this._symbols = other._symbols;
2847
- this._overrideChronology = other._overrideChronology;
2848
- this._overrideZone = other._overrideZone;
2849
- this._caseSensitive = other._caseSensitive;
2850
- this._strict = other._strict;
2851
- this._parsed = [new Parsed(this)];
2852
- };
2853
- _proto.copy = function copy() {
2854
- return new DateTimeParseContext(this);
2855
- };
2856
- _proto.symbols = function symbols() {
2857
- return this._symbols;
2858
- };
2859
- _proto.isStrict = function isStrict() {
2860
- return this._strict;
2861
- };
2862
- _proto.setStrict = function setStrict(strict) {
2863
- this._strict = strict;
2864
- };
2865
- _proto.locale = function locale() {
2866
- return this._locale;
2867
- };
2868
- _proto.setLocale = function setLocale(locale) {
2869
- this._locale = locale;
2870
- };
2871
- _proto.startOptional = function startOptional() {
2872
- this._parsed.push(this.currentParsed().copy());
2873
- };
2874
- _proto.endOptional = function endOptional(successful) {
2875
- if (successful) {
2876
- this._parsed.splice(this._parsed.length - 2, 1);
2877
- } else {
2878
- this._parsed.splice(this._parsed.length - 1, 1);
2879
- }
2880
- };
2881
- _proto.isCaseSensitive = function isCaseSensitive() {
2882
- return this._caseSensitive;
2873
+ _proto.adjustInto = function adjustInto(temporal) {
2874
+ return temporal.with(ChronoField.OFFSET_SECONDS, this._totalSeconds);
2883
2875
  };
2884
- _proto.setCaseSensitive = function setCaseSensitive(caseSensitive) {
2885
- this._caseSensitive = caseSensitive;
2876
+ _proto.compareTo = function compareTo(other) {
2877
+ requireNonNull(other, 'other');
2878
+ return other._totalSeconds - this._totalSeconds;
2886
2879
  };
2887
- _proto.subSequenceEquals = function subSequenceEquals(cs1, offset1, cs2, offset2, length) {
2888
- if (offset1 + length > cs1.length || offset2 + length > cs2.length) {
2889
- return false;
2890
- }
2891
- if (!this.isCaseSensitive()) {
2892
- cs1 = cs1.toLowerCase();
2893
- cs2 = cs2.toLowerCase();
2894
- }
2895
- for (var i = 0; i < length; i++) {
2896
- var ch1 = cs1[offset1 + i];
2897
- var ch2 = cs2[offset2 + i];
2898
- if (ch1 !== ch2) {
2899
- return false;
2900
- }
2880
+ _proto.equals = function equals(obj) {
2881
+ if (this === obj) {
2882
+ return true;
2901
2883
  }
2902
- return true;
2903
- };
2904
- _proto.charEquals = function charEquals(ch1, ch2) {
2905
- if (this.isCaseSensitive()) {
2906
- return ch1 === ch2;
2884
+ if (obj instanceof ZoneOffset) {
2885
+ return this._totalSeconds === obj._totalSeconds;
2907
2886
  }
2908
- return this.charEqualsIgnoreCase(ch1, ch2);
2909
- };
2910
- _proto.charEqualsIgnoreCase = function charEqualsIgnoreCase(c1, c2) {
2911
- return c1 === c2 || c1.toLowerCase() === c2.toLowerCase();
2912
- };
2913
- _proto.setParsedField = function setParsedField(field, value, errorPos, successPos) {
2914
- var currentParsedFieldValues = this.currentParsed().fieldValues;
2915
- var old = currentParsedFieldValues.get(field);
2916
- currentParsedFieldValues.set(field, value);
2917
- return old != null && old !== value ? ~errorPos : successPos;
2918
- };
2919
- _proto.setParsedZone = function setParsedZone(zone) {
2920
- requireNonNull(zone, 'zone');
2921
- this.currentParsed().zone = zone;
2922
- };
2923
- _proto.getParsed = function getParsed(field) {
2924
- return this.currentParsed().fieldValues.get(field);
2925
- };
2926
- _proto.toParsed = function toParsed() {
2927
- return this.currentParsed();
2928
- };
2929
- _proto.currentParsed = function currentParsed() {
2930
- return this._parsed[this._parsed.length - 1];
2887
+ return false;
2931
2888
  };
2932
- _proto.setParsedLeapSecond = function setParsedLeapSecond() {
2933
- this.currentParsed().leapSecond = true;
2889
+ _proto.hashCode = function hashCode() {
2890
+ return this._totalSeconds;
2934
2891
  };
2935
- _proto.getEffectiveChronology = function getEffectiveChronology() {
2936
- var chrono = this.currentParsed().chrono;
2937
- if (chrono == null) {
2938
- chrono = this._overrideChronology;
2939
- if (chrono == null) {
2940
- chrono = IsoChronology.INSTANCE;
2941
- }
2942
- }
2943
- return chrono;
2892
+ _proto.toString = function toString() {
2893
+ return this._id;
2944
2894
  };
2945
- return DateTimeParseContext;
2946
- }();
2947
- var Parsed = function (_Temporal) {
2948
- function Parsed(dateTimeParseContext) {
2895
+ return ZoneOffset;
2896
+ }(ZoneId);
2897
+ function _init$f() {
2898
+ ZoneOffset.MAX_SECONDS = 18 * LocalTime.SECONDS_PER_HOUR;
2899
+ ZoneOffset.UTC = ZoneOffset.ofTotalSeconds(0);
2900
+ ZoneOffset.MIN = ZoneOffset.ofTotalSeconds(-ZoneOffset.MAX_SECONDS);
2901
+ ZoneOffset.MAX = ZoneOffset.ofTotalSeconds(ZoneOffset.MAX_SECONDS);
2902
+ }
2903
+
2904
+ var DateTimeBuilder = function (_TemporalAccessor) {
2905
+ function DateTimeBuilder() {
2949
2906
  var _this;
2950
- _this = _Temporal.call(this) || this;
2907
+ _this = _TemporalAccessor.call(this) || this;
2908
+ _this.fieldValues = new EnumMap();
2951
2909
  _this.chrono = null;
2952
2910
  _this.zone = null;
2953
- _this.fieldValues = new EnumMap();
2911
+ _this.date = null;
2912
+ _this.time = null;
2954
2913
  _this.leapSecond = false;
2955
- _this.excessDays = Period.ZERO;
2956
- _this.dateTimeParseContext = dateTimeParseContext;
2914
+ _this.excessDays = null;
2957
2915
  return _this;
2958
2916
  }
2959
- _inheritsLoose(Parsed, _Temporal);
2960
- var _proto2 = Parsed.prototype;
2961
- _proto2.copy = function copy() {
2962
- var cloned = new Parsed();
2963
- cloned.chrono = this.chrono;
2964
- cloned.zone = this.zone;
2965
- cloned.fieldValues.putAll(this.fieldValues);
2966
- cloned.leapSecond = this.leapSecond;
2967
- cloned.dateTimeParseContext = this.dateTimeParseContext;
2968
- return cloned;
2917
+ _inheritsLoose(DateTimeBuilder, _TemporalAccessor);
2918
+ DateTimeBuilder.create = function create(field, value) {
2919
+ var dtb = new DateTimeBuilder();
2920
+ dtb._addFieldValue(field, value);
2921
+ return dtb;
2969
2922
  };
2970
- _proto2.toString = function toString() {
2971
- return this.fieldValues + ", " + this.chrono + ", " + this.zone;
2923
+ var _proto = DateTimeBuilder.prototype;
2924
+ _proto.getFieldValue0 = function getFieldValue0(field) {
2925
+ return this.fieldValues.get(field);
2972
2926
  };
2973
- _proto2.isSupported = function isSupported(field) {
2974
- return this.fieldValues.containsKey(field);
2927
+ _proto._addFieldValue = function _addFieldValue(field, value) {
2928
+ requireNonNull(field, 'field');
2929
+ var old = this.getFieldValue0(field);
2930
+ if (old != null && old !== value) {
2931
+ throw new DateTimeException("Conflict found: " + field + " " + old + " differs from " + field + " " + value + ": " + this);
2932
+ }
2933
+ return this._putFieldValue0(field, value);
2975
2934
  };
2976
- _proto2.get = function get(field) {
2977
- var val = this.fieldValues.get(field);
2978
- assert(val != null);
2979
- return val;
2935
+ _proto._putFieldValue0 = function _putFieldValue0(field, value) {
2936
+ this.fieldValues.put(field, value);
2937
+ return this;
2980
2938
  };
2981
- _proto2.query = function query(_query) {
2982
- if (_query === TemporalQueries.chronology()) {
2983
- return this.chrono;
2939
+ _proto.resolve = function resolve(resolverStyle, resolverFields) {
2940
+ if (resolverFields != null) {
2941
+ this.fieldValues.retainAll(resolverFields);
2984
2942
  }
2985
- if (_query === TemporalQueries.zoneId() || _query === TemporalQueries.zone()) {
2986
- return this.zone;
2943
+ if (this._resolveFields(resolverStyle)) ;
2944
+ this._mergeDate(resolverStyle);
2945
+ this._mergeTime(resolverStyle);
2946
+ this._resolveTimeInferZeroes(resolverStyle);
2947
+ if (this.excessDays != null && this.excessDays.isZero() === false && this.date != null && this.time != null) {
2948
+ this.date = this.date.plus(this.excessDays);
2949
+ this.excessDays = Period.ZERO;
2987
2950
  }
2988
- return _Temporal.prototype.query.call(this, _query);
2951
+ this._resolveInstant();
2952
+ return this;
2989
2953
  };
2990
- _proto2.toBuilder = function toBuilder() {
2991
- var builder = new DateTimeBuilder();
2992
- builder.fieldValues.putAll(this.fieldValues);
2993
- builder.chrono = this.dateTimeParseContext.getEffectiveChronology();
2994
- if (this.zone != null) {
2995
- builder.zone = this.zone;
2996
- } else {
2997
- builder.zone = this.overrideZone;
2954
+ _proto._resolveFields = function _resolveFields(resolverStyle) {
2955
+ var resolved = false;
2956
+ for (var _i = 0, _arr = [IsoFields.WEEK_OF_WEEK_BASED_YEAR, IsoFields.DAY_OF_QUARTER]; _i < _arr.length; _i++) {
2957
+ var field = _arr[_i];
2958
+ if (this.fieldValues.containsKey(field)) {
2959
+ var date = field.resolve(this.fieldValues, this, resolverStyle);
2960
+ if (date != null) {
2961
+ this._checkDate(date);
2962
+ resolved = true;
2963
+ }
2964
+ }
2998
2965
  }
2999
- builder.leapSecond = this.leapSecond;
3000
- builder.excessDays = this.excessDays;
3001
- return builder;
2966
+ return resolved;
3002
2967
  };
3003
- return Parsed;
3004
- }(Temporal);
3005
-
3006
- /*
3007
- * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
3008
- * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
3009
- * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
3010
- */
3011
-
3012
- var DateTimePrintContext = function () {
3013
- function DateTimePrintContext(temporal, localeOrFormatter, symbols) {
3014
- if (arguments.length === 2 && arguments[1] instanceof DateTimeFormatter) {
3015
- this._temporal = DateTimePrintContext.adjust(temporal, localeOrFormatter);
3016
- this._locale = localeOrFormatter.locale();
3017
- this._symbols = localeOrFormatter.decimalStyle();
3018
- } else {
3019
- this._temporal = temporal;
3020
- this._locale = localeOrFormatter;
3021
- this._symbols = symbols;
3022
- }
3023
- this._optional = 0;
3024
- }
3025
- DateTimePrintContext.adjust = function adjust(temporal, formatter) {
3026
- return temporal;
3027
- };
3028
- var _proto = DateTimePrintContext.prototype;
3029
- _proto.symbols = function symbols() {
3030
- return this._symbols;
3031
- };
3032
- _proto.startOptional = function startOptional() {
3033
- this._optional++;
3034
- };
3035
- _proto.endOptional = function endOptional() {
3036
- this._optional--;
2968
+ _proto._mergeDate = function _mergeDate(resolverStyle) {
2969
+ this._checkDate(IsoChronology.INSTANCE.resolveDate(this.fieldValues, resolverStyle));
3037
2970
  };
3038
- _proto.getValueQuery = function getValueQuery(query) {
3039
- var result = this._temporal.query(query);
3040
- if (result == null && this._optional === 0) {
3041
- throw new DateTimeException("Unable to extract value: " + this._temporal);
2971
+ _proto._checkDate = function _checkDate(date) {
2972
+ if (date != null) {
2973
+ this._addObject(date);
2974
+ for (var fieldName in this.fieldValues.keySet()) {
2975
+ var field = ChronoField.byName(fieldName);
2976
+ if (field) {
2977
+ if (this.fieldValues.get(field) !== undefined) {
2978
+ if (field.isDateBased()) {
2979
+ var val1 = void 0;
2980
+ try {
2981
+ val1 = date.getLong(field);
2982
+ } catch (ex) {
2983
+ if (ex instanceof DateTimeException) {
2984
+ continue;
2985
+ } else {
2986
+ throw ex;
2987
+ }
2988
+ }
2989
+ var val2 = this.fieldValues.get(field);
2990
+ if (val1 !== val2) {
2991
+ throw new DateTimeException("Conflict found: Field " + field + " " + val1 + " differs from " + field + " " + val2 + " derived from " + date);
2992
+ }
2993
+ }
2994
+ }
2995
+ }
2996
+ }
3042
2997
  }
3043
- return result;
3044
2998
  };
3045
- _proto.getValue = function getValue(field) {
3046
- try {
3047
- return this._temporal.getLong(field);
3048
- } catch (ex) {
3049
- if (ex instanceof DateTimeException && this._optional > 0) {
3050
- return null;
2999
+ _proto._mergeTime = function _mergeTime(resolverStyle) {
3000
+ if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_DAY)) {
3001
+ var ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_DAY);
3002
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3003
+ if (resolverStyle === ResolverStyle.SMART && ch === 0) ; else {
3004
+ ChronoField.CLOCK_HOUR_OF_DAY.checkValidValue(ch);
3005
+ }
3051
3006
  }
3052
- throw ex;
3007
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, ch === 24 ? 0 : ch);
3053
3008
  }
3054
- };
3055
- _proto.temporal = function temporal() {
3056
- return this._temporal;
3057
- };
3058
- _proto.locale = function locale() {
3059
- return this._locale;
3060
- };
3061
- _proto.setDateTime = function setDateTime(temporal) {
3062
- this._temporal = temporal;
3063
- };
3064
- _proto.setLocale = function setLocale(locale) {
3065
- this._locale = locale;
3066
- };
3067
- return DateTimePrintContext;
3068
- }();
3069
-
3070
- var IsoFields = {};
3071
- var QUARTER_DAYS = [0, 90, 181, 273, 0, 91, 182, 274];
3072
- var Field = function (_TemporalField) {
3073
- function Field() {
3074
- return _TemporalField.apply(this, arguments) || this;
3075
- }
3076
- _inheritsLoose(Field, _TemporalField);
3077
- var _proto = Field.prototype;
3078
- _proto.isDateBased = function isDateBased() {
3079
- return true;
3080
- };
3081
- _proto.isTimeBased = function isTimeBased() {
3082
- return false;
3083
- };
3084
- _proto._isIso = function _isIso() {
3085
- return true;
3086
- };
3087
- Field._getWeekRangeByLocalDate = function _getWeekRangeByLocalDate(date) {
3088
- var wby = Field._getWeekBasedYear(date);
3089
- return ValueRange.of(1, Field._getWeekRangeByYear(wby));
3090
- };
3091
- Field._getWeekRangeByYear = function _getWeekRangeByYear(wby) {
3092
- var date = LocalDate.of(wby, 1, 1);
3093
- if (date.dayOfWeek() === DayOfWeek.THURSDAY || date.dayOfWeek() === DayOfWeek.WEDNESDAY && date.isLeapYear()) {
3094
- return 53;
3009
+ if (this.fieldValues.containsKey(ChronoField.CLOCK_HOUR_OF_AMPM)) {
3010
+ var _ch = this.fieldValues.remove(ChronoField.CLOCK_HOUR_OF_AMPM);
3011
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3012
+ if (resolverStyle === ResolverStyle.SMART && _ch === 0) ; else {
3013
+ ChronoField.CLOCK_HOUR_OF_AMPM.checkValidValue(_ch);
3014
+ }
3015
+ }
3016
+ this._addFieldValue(ChronoField.HOUR_OF_AMPM, _ch === 12 ? 0 : _ch);
3095
3017
  }
3096
- return 52;
3097
- };
3098
- Field._getWeek = function _getWeek(date) {
3099
- var dow0 = date.dayOfWeek().ordinal();
3100
- var doy0 = date.dayOfYear() - 1;
3101
- var doyThu0 = doy0 + (3 - dow0);
3102
- var alignedWeek = MathUtil.intDiv(doyThu0, 7);
3103
- var firstThuDoy0 = doyThu0 - alignedWeek * 7;
3104
- var firstMonDoy0 = firstThuDoy0 - 3;
3105
- if (firstMonDoy0 < -3) {
3106
- firstMonDoy0 += 7;
3018
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3019
+ if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY)) {
3020
+ ChronoField.AMPM_OF_DAY.checkValidValue(this.fieldValues.get(ChronoField.AMPM_OF_DAY));
3021
+ }
3022
+ if (this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
3023
+ ChronoField.HOUR_OF_AMPM.checkValidValue(this.fieldValues.get(ChronoField.HOUR_OF_AMPM));
3024
+ }
3107
3025
  }
3108
- if (doy0 < firstMonDoy0) {
3109
- return Field._getWeekRangeByLocalDate(date.withDayOfYear(180).minusYears(1)).maximum();
3026
+ if (this.fieldValues.containsKey(ChronoField.AMPM_OF_DAY) && this.fieldValues.containsKey(ChronoField.HOUR_OF_AMPM)) {
3027
+ var ap = this.fieldValues.remove(ChronoField.AMPM_OF_DAY);
3028
+ var hap = this.fieldValues.remove(ChronoField.HOUR_OF_AMPM);
3029
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, ap * 12 + hap);
3110
3030
  }
3111
- var week = MathUtil.intDiv(doy0 - firstMonDoy0, 7) + 1;
3112
- if (week === 53) {
3113
- if ((firstMonDoy0 === -3 || firstMonDoy0 === -2 && date.isLeapYear()) === false) {
3114
- week = 1;
3031
+ if (this.fieldValues.containsKey(ChronoField.NANO_OF_DAY)) {
3032
+ var nod = this.fieldValues.remove(ChronoField.NANO_OF_DAY);
3033
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3034
+ ChronoField.NANO_OF_DAY.checkValidValue(nod);
3115
3035
  }
3036
+ this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(nod, 1000000000));
3037
+ this._addFieldValue(ChronoField.NANO_OF_SECOND, MathUtil.intMod(nod, 1000000000));
3116
3038
  }
3117
- return week;
3118
- };
3119
- Field._getWeekBasedYear = function _getWeekBasedYear(date) {
3120
- var year = date.year();
3121
- var doy = date.dayOfYear();
3122
- if (doy <= 3) {
3123
- var dow = date.dayOfWeek().ordinal();
3124
- if (doy - dow < -2) {
3125
- year--;
3039
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_DAY)) {
3040
+ var cod = this.fieldValues.remove(ChronoField.MICRO_OF_DAY);
3041
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3042
+ ChronoField.MICRO_OF_DAY.checkValidValue(cod);
3126
3043
  }
3127
- } else if (doy >= 363) {
3128
- var _dow = date.dayOfWeek().ordinal();
3129
- doy = doy - 363 - (date.isLeapYear() ? 1 : 0);
3130
- if (doy - _dow >= 0) {
3131
- year++;
3044
+ this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(cod, 1000000));
3045
+ this._addFieldValue(ChronoField.MICRO_OF_SECOND, MathUtil.intMod(cod, 1000000));
3046
+ }
3047
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_DAY)) {
3048
+ var lod = this.fieldValues.remove(ChronoField.MILLI_OF_DAY);
3049
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3050
+ ChronoField.MILLI_OF_DAY.checkValidValue(lod);
3132
3051
  }
3052
+ this._addFieldValue(ChronoField.SECOND_OF_DAY, MathUtil.intDiv(lod, 1000));
3053
+ this._addFieldValue(ChronoField.MILLI_OF_SECOND, MathUtil.intMod(lod, 1000));
3054
+ }
3055
+ if (this.fieldValues.containsKey(ChronoField.SECOND_OF_DAY)) {
3056
+ var sod = this.fieldValues.remove(ChronoField.SECOND_OF_DAY);
3057
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3058
+ ChronoField.SECOND_OF_DAY.checkValidValue(sod);
3059
+ }
3060
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(sod, 3600));
3061
+ this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(MathUtil.intDiv(sod, 60), 60));
3062
+ this._addFieldValue(ChronoField.SECOND_OF_MINUTE, MathUtil.intMod(sod, 60));
3063
+ }
3064
+ if (this.fieldValues.containsKey(ChronoField.MINUTE_OF_DAY)) {
3065
+ var mod = this.fieldValues.remove(ChronoField.MINUTE_OF_DAY);
3066
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3067
+ ChronoField.MINUTE_OF_DAY.checkValidValue(mod);
3068
+ }
3069
+ this._addFieldValue(ChronoField.HOUR_OF_DAY, MathUtil.intDiv(mod, 60));
3070
+ this._addFieldValue(ChronoField.MINUTE_OF_HOUR, MathUtil.intMod(mod, 60));
3071
+ }
3072
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3073
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
3074
+ ChronoField.MILLI_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MILLI_OF_SECOND));
3075
+ }
3076
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
3077
+ ChronoField.MICRO_OF_SECOND.checkValidValue(this.fieldValues.get(ChronoField.MICRO_OF_SECOND));
3078
+ }
3079
+ }
3080
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
3081
+ var los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
3082
+ var cos = this.fieldValues.get(ChronoField.MICRO_OF_SECOND);
3083
+ this._putFieldValue0(ChronoField.MICRO_OF_SECOND, los * 1000 + MathUtil.intMod(cos, 1000));
3084
+ }
3085
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
3086
+ var nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
3087
+ this._putFieldValue0(ChronoField.MICRO_OF_SECOND, MathUtil.intDiv(nos, 1000));
3088
+ this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
3089
+ }
3090
+ if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND) && this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
3091
+ var _nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
3092
+ this._putFieldValue0(ChronoField.MILLI_OF_SECOND, MathUtil.intDiv(_nos, 1000000));
3093
+ this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
3094
+ }
3095
+ if (this.fieldValues.containsKey(ChronoField.MICRO_OF_SECOND)) {
3096
+ var _cos = this.fieldValues.remove(ChronoField.MICRO_OF_SECOND);
3097
+ this._putFieldValue0(ChronoField.NANO_OF_SECOND, _cos * 1000);
3098
+ } else if (this.fieldValues.containsKey(ChronoField.MILLI_OF_SECOND)) {
3099
+ var _los = this.fieldValues.remove(ChronoField.MILLI_OF_SECOND);
3100
+ this._putFieldValue0(ChronoField.NANO_OF_SECOND, _los * 1000000);
3133
3101
  }
3134
- return year;
3135
- };
3136
- _proto.displayName = function displayName() {
3137
- return this.toString();
3138
- };
3139
- _proto.resolve = function resolve() {
3140
- return null;
3141
- };
3142
- _proto.name = function name() {
3143
- return this.toString();
3144
- };
3145
- return Field;
3146
- }(TemporalField);
3147
- var DAY_OF_QUARTER_FIELD = function (_Field) {
3148
- function DAY_OF_QUARTER_FIELD() {
3149
- return _Field.apply(this, arguments) || this;
3150
- }
3151
- _inheritsLoose(DAY_OF_QUARTER_FIELD, _Field);
3152
- var _proto2 = DAY_OF_QUARTER_FIELD.prototype;
3153
- _proto2.toString = function toString() {
3154
- return 'DayOfQuarter';
3155
3102
  };
3156
- _proto2.baseUnit = function baseUnit() {
3157
- return ChronoUnit.DAYS;
3103
+ _proto._resolveTimeInferZeroes = function _resolveTimeInferZeroes(resolverStyle) {
3104
+ var hod = this.fieldValues.get(ChronoField.HOUR_OF_DAY);
3105
+ var moh = this.fieldValues.get(ChronoField.MINUTE_OF_HOUR);
3106
+ var som = this.fieldValues.get(ChronoField.SECOND_OF_MINUTE);
3107
+ var nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
3108
+ if (hod == null) {
3109
+ return;
3110
+ }
3111
+ if (moh == null && (som != null || nos != null)) {
3112
+ return;
3113
+ }
3114
+ if (moh != null && som == null && nos != null) {
3115
+ return;
3116
+ }
3117
+ if (resolverStyle !== ResolverStyle.LENIENT) {
3118
+ if (hod != null) {
3119
+ if (resolverStyle === ResolverStyle.SMART && hod === 24 && (moh == null || moh === 0) && (som == null || som === 0) && (nos == null || nos === 0)) {
3120
+ hod = 0;
3121
+ this.excessDays = Period.ofDays(1);
3122
+ }
3123
+ var hodVal = ChronoField.HOUR_OF_DAY.checkValidIntValue(hod);
3124
+ if (moh != null) {
3125
+ var mohVal = ChronoField.MINUTE_OF_HOUR.checkValidIntValue(moh);
3126
+ if (som != null) {
3127
+ var somVal = ChronoField.SECOND_OF_MINUTE.checkValidIntValue(som);
3128
+ if (nos != null) {
3129
+ var nosVal = ChronoField.NANO_OF_SECOND.checkValidIntValue(nos);
3130
+ this._addObject(LocalTime.of(hodVal, mohVal, somVal, nosVal));
3131
+ } else {
3132
+ this._addObject(LocalTime.of(hodVal, mohVal, somVal));
3133
+ }
3134
+ } else {
3135
+ if (nos == null) {
3136
+ this._addObject(LocalTime.of(hodVal, mohVal));
3137
+ }
3138
+ }
3139
+ } else {
3140
+ if (som == null && nos == null) {
3141
+ this._addObject(LocalTime.of(hodVal, 0));
3142
+ }
3143
+ }
3144
+ }
3145
+ } else {
3146
+ if (hod != null) {
3147
+ var _hodVal = hod;
3148
+ if (moh != null) {
3149
+ if (som != null) {
3150
+ if (nos == null) {
3151
+ nos = 0;
3152
+ }
3153
+ var totalNanos = MathUtil.safeMultiply(_hodVal, 3600000000000);
3154
+ totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(moh, 60000000000));
3155
+ totalNanos = MathUtil.safeAdd(totalNanos, MathUtil.safeMultiply(som, 1000000000));
3156
+ totalNanos = MathUtil.safeAdd(totalNanos, nos);
3157
+ var excessDays = MathUtil.floorDiv(totalNanos, 86400000000000);
3158
+ var nod = MathUtil.floorMod(totalNanos, 86400000000000);
3159
+ this._addObject(LocalTime.ofNanoOfDay(nod));
3160
+ this.excessDays = Period.ofDays(excessDays);
3161
+ } else {
3162
+ var totalSecs = MathUtil.safeMultiply(_hodVal, 3600);
3163
+ totalSecs = MathUtil.safeAdd(totalSecs, MathUtil.safeMultiply(moh, 60));
3164
+ var _excessDays = MathUtil.floorDiv(totalSecs, 86400);
3165
+ var sod = MathUtil.floorMod(totalSecs, 86400);
3166
+ this._addObject(LocalTime.ofSecondOfDay(sod));
3167
+ this.excessDays = Period.ofDays(_excessDays);
3168
+ }
3169
+ } else {
3170
+ var _excessDays2 = MathUtil.safeToInt(MathUtil.floorDiv(_hodVal, 24));
3171
+ _hodVal = MathUtil.floorMod(_hodVal, 24);
3172
+ this._addObject(LocalTime.of(_hodVal, 0));
3173
+ this.excessDays = Period.ofDays(_excessDays2);
3174
+ }
3175
+ }
3176
+ }
3177
+ this.fieldValues.remove(ChronoField.HOUR_OF_DAY);
3178
+ this.fieldValues.remove(ChronoField.MINUTE_OF_HOUR);
3179
+ this.fieldValues.remove(ChronoField.SECOND_OF_MINUTE);
3180
+ this.fieldValues.remove(ChronoField.NANO_OF_SECOND);
3158
3181
  };
3159
- _proto2.rangeUnit = function rangeUnit() {
3160
- return QUARTER_YEARS;
3182
+ _proto._addObject = function _addObject(dateOrTime) {
3183
+ if (dateOrTime instanceof ChronoLocalDate) {
3184
+ this.date = dateOrTime;
3185
+ } else if (dateOrTime instanceof LocalTime) {
3186
+ this.time = dateOrTime;
3187
+ }
3161
3188
  };
3162
- _proto2.range = function range() {
3163
- return ValueRange.of(1, 90, 92);
3189
+ _proto._resolveInstant = function _resolveInstant() {
3190
+ if (this.date != null && this.time != null) {
3191
+ var offsetSecs = this.fieldValues.get(ChronoField.OFFSET_SECONDS);
3192
+ if (offsetSecs != null) {
3193
+ var offset = ZoneOffset.ofTotalSeconds(offsetSecs);
3194
+ var instant = this.date.atTime(this.time).atZone(offset).getLong(ChronoField.INSTANT_SECONDS);
3195
+ this.fieldValues.put(ChronoField.INSTANT_SECONDS, instant);
3196
+ } else if (this.zone != null) {
3197
+ var _instant = this.date.atTime(this.time).atZone(this.zone).getLong(ChronoField.INSTANT_SECONDS);
3198
+ this.fieldValues.put(ChronoField.INSTANT_SECONDS, _instant);
3199
+ }
3200
+ }
3164
3201
  };
3165
- _proto2.isSupportedBy = function isSupportedBy(temporal) {
3166
- return temporal.isSupported(ChronoField.DAY_OF_YEAR) && temporal.isSupported(ChronoField.MONTH_OF_YEAR) && temporal.isSupported(ChronoField.YEAR) && this._isIso(temporal);
3202
+ _proto.build = function build(type) {
3203
+ return type.queryFrom(this);
3167
3204
  };
3168
- _proto2.rangeRefinedBy = function rangeRefinedBy(temporal) {
3169
- if (temporal.isSupported(this) === false) {
3170
- throw new UnsupportedTemporalTypeException('Unsupported field: DayOfQuarter');
3171
- }
3172
- var qoy = temporal.getLong(QUARTER_OF_YEAR);
3173
- if (qoy === 1) {
3174
- var year = temporal.getLong(ChronoField.YEAR);
3175
- return IsoChronology.isLeapYear(year) ? ValueRange.of(1, 91) : ValueRange.of(1, 90);
3176
- } else if (qoy === 2) {
3177
- return ValueRange.of(1, 91);
3178
- } else if (qoy === 3 || qoy === 4) {
3179
- return ValueRange.of(1, 92);
3205
+ _proto.isSupported = function isSupported(field) {
3206
+ if (field == null) {
3207
+ return false;
3180
3208
  }
3181
- return this.range();
3209
+ return this.fieldValues.containsKey(field) && this.fieldValues.get(field) !== undefined || this.date != null && this.date.isSupported(field) || this.time != null && this.time.isSupported(field);
3182
3210
  };
3183
- _proto2.getFrom = function getFrom(temporal) {
3184
- if (temporal.isSupported(this) === false) {
3185
- throw new UnsupportedTemporalTypeException('Unsupported field: DayOfQuarter');
3211
+ _proto.getLong = function getLong(field) {
3212
+ requireNonNull(field, 'field');
3213
+ var value = this.getFieldValue0(field);
3214
+ if (value == null) {
3215
+ if (this.date != null && this.date.isSupported(field)) {
3216
+ return this.date.getLong(field);
3217
+ }
3218
+ if (this.time != null && this.time.isSupported(field)) {
3219
+ return this.time.getLong(field);
3220
+ }
3221
+ throw new DateTimeException("Field not found: " + field);
3186
3222
  }
3187
- var doy = temporal.get(ChronoField.DAY_OF_YEAR);
3188
- var moy = temporal.get(ChronoField.MONTH_OF_YEAR);
3189
- var year = temporal.getLong(ChronoField.YEAR);
3190
- return doy - QUARTER_DAYS[MathUtil.intDiv(moy - 1, 3) + (IsoChronology.isLeapYear(year) ? 4 : 0)];
3191
- };
3192
- _proto2.adjustInto = function adjustInto(temporal, newValue) {
3193
- var curValue = this.getFrom(temporal);
3194
- this.range().checkValidValue(newValue, this);
3195
- return temporal.with(ChronoField.DAY_OF_YEAR, temporal.getLong(ChronoField.DAY_OF_YEAR) + (newValue - curValue));
3223
+ return value;
3196
3224
  };
3197
- _proto2.resolve = function resolve(fieldValues, partialTemporal, resolverStyle) {
3198
- var yearLong = fieldValues.get(ChronoField.YEAR);
3199
- var qoyLong = fieldValues.get(QUARTER_OF_YEAR);
3200
- if (yearLong == null || qoyLong == null) {
3225
+ _proto.query = function query(_query) {
3226
+ if (_query === TemporalQueries.zoneId()) {
3227
+ return this.zone;
3228
+ } else if (_query === TemporalQueries.chronology()) {
3229
+ return this.chrono;
3230
+ } else if (_query === TemporalQueries.localDate()) {
3231
+ return this.date != null ? LocalDate.from(this.date) : null;
3232
+ } else if (_query === TemporalQueries.localTime()) {
3233
+ return this.time;
3234
+ } else if (_query === TemporalQueries.zone() || _query === TemporalQueries.offset()) {
3235
+ return _query.queryFrom(this);
3236
+ } else if (_query === TemporalQueries.precision()) {
3201
3237
  return null;
3202
3238
  }
3203
- var y = ChronoField.YEAR.checkValidIntValue(yearLong);
3204
- var doq = fieldValues.get(DAY_OF_QUARTER);
3205
- var date;
3206
- if (resolverStyle === ResolverStyle.LENIENT) {
3207
- var qoy = qoyLong;
3208
- date = LocalDate.of(y, 1, 1);
3209
- date = date.plusMonths(MathUtil.safeMultiply(MathUtil.safeSubtract(qoy, 1), 3));
3210
- date = date.plusDays(MathUtil.safeSubtract(doq, 1));
3211
- } else {
3212
- var _qoy = QUARTER_OF_YEAR.range().checkValidIntValue(qoyLong, QUARTER_OF_YEAR);
3213
- if (resolverStyle === ResolverStyle.STRICT) {
3214
- var max = 92;
3215
- if (_qoy === 1) {
3216
- max = IsoChronology.isLeapYear(y) ? 91 : 90;
3217
- } else if (_qoy === 2) {
3218
- max = 91;
3219
- }
3220
- ValueRange.of(1, max).checkValidValue(doq, this);
3239
+ return _query.queryFrom(this);
3240
+ };
3241
+ return DateTimeBuilder;
3242
+ }(TemporalAccessor);
3243
+
3244
+ var DateTimeParseContext = function () {
3245
+ function DateTimeParseContext() {
3246
+ if (arguments.length === 1) {
3247
+ if (arguments[0] instanceof DateTimeParseContext) {
3248
+ this._constructorSelf.apply(this, arguments);
3249
+ return;
3221
3250
  } else {
3222
- this.range().checkValidValue(doq, this);
3251
+ this._constructorFormatter.apply(this, arguments);
3223
3252
  }
3224
- date = LocalDate.of(y, (_qoy - 1) * 3 + 1, 1).plusDays(doq - 1);
3253
+ } else {
3254
+ this._constructorParam.apply(this, arguments);
3225
3255
  }
3226
- fieldValues.remove(this);
3227
- fieldValues.remove(ChronoField.YEAR);
3228
- fieldValues.remove(QUARTER_OF_YEAR);
3229
- return date;
3230
- };
3231
- return DAY_OF_QUARTER_FIELD;
3232
- }(Field);
3233
- var QUARTER_OF_YEAR_FIELD = function (_Field2) {
3234
- function QUARTER_OF_YEAR_FIELD() {
3235
- return _Field2.apply(this, arguments) || this;
3256
+ this._caseSensitive = true;
3257
+ this._strict = true;
3258
+ this._parsed = [new Parsed(this)];
3236
3259
  }
3237
- _inheritsLoose(QUARTER_OF_YEAR_FIELD, _Field2);
3238
- var _proto3 = QUARTER_OF_YEAR_FIELD.prototype;
3239
- _proto3.toString = function toString() {
3240
- return 'QuarterOfYear';
3241
- };
3242
- _proto3.baseUnit = function baseUnit() {
3243
- return QUARTER_YEARS;
3244
- };
3245
- _proto3.rangeUnit = function rangeUnit() {
3246
- return ChronoUnit.YEARS;
3247
- };
3248
- _proto3.range = function range() {
3249
- return ValueRange.of(1, 4);
3260
+ var _proto = DateTimeParseContext.prototype;
3261
+ _proto._constructorParam = function _constructorParam(locale, symbols, chronology) {
3262
+ this._locale = locale;
3263
+ this._symbols = symbols;
3264
+ this._overrideChronology = chronology;
3250
3265
  };
3251
- _proto3.isSupportedBy = function isSupportedBy(temporal) {
3252
- return temporal.isSupported(ChronoField.MONTH_OF_YEAR) && this._isIso(temporal);
3266
+ _proto._constructorFormatter = function _constructorFormatter(formatter) {
3267
+ this._locale = formatter.locale();
3268
+ this._symbols = formatter.decimalStyle();
3269
+ this._overrideChronology = formatter.chronology();
3253
3270
  };
3254
- _proto3.rangeRefinedBy = function rangeRefinedBy(temporal) {
3255
- return this.range();
3271
+ _proto._constructorSelf = function _constructorSelf(other) {
3272
+ this._locale = other._locale;
3273
+ this._symbols = other._symbols;
3274
+ this._overrideChronology = other._overrideChronology;
3275
+ this._overrideZone = other._overrideZone;
3276
+ this._caseSensitive = other._caseSensitive;
3277
+ this._strict = other._strict;
3278
+ this._parsed = [new Parsed(this)];
3256
3279
  };
3257
- _proto3.getFrom = function getFrom(temporal) {
3258
- if (temporal.isSupported(this) === false) {
3259
- throw new UnsupportedTemporalTypeException('Unsupported field: QuarterOfYear');
3260
- }
3261
- var moy = temporal.getLong(ChronoField.MONTH_OF_YEAR);
3262
- return MathUtil.intDiv(moy + 2, 3);
3280
+ _proto.copy = function copy() {
3281
+ return new DateTimeParseContext(this);
3263
3282
  };
3264
- _proto3.adjustInto = function adjustInto(temporal, newValue) {
3265
- var curValue = this.getFrom(temporal);
3266
- this.range().checkValidValue(newValue, this);
3267
- return temporal.with(ChronoField.MONTH_OF_YEAR, temporal.getLong(ChronoField.MONTH_OF_YEAR) + (newValue - curValue) * 3);
3283
+ _proto.symbols = function symbols() {
3284
+ return this._symbols;
3268
3285
  };
3269
- return QUARTER_OF_YEAR_FIELD;
3270
- }(Field);
3271
- var WEEK_OF_WEEK_BASED_YEAR_FIELD = function (_Field3) {
3272
- function WEEK_OF_WEEK_BASED_YEAR_FIELD() {
3273
- return _Field3.apply(this, arguments) || this;
3274
- }
3275
- _inheritsLoose(WEEK_OF_WEEK_BASED_YEAR_FIELD, _Field3);
3276
- var _proto4 = WEEK_OF_WEEK_BASED_YEAR_FIELD.prototype;
3277
- _proto4.toString = function toString() {
3278
- return 'WeekOfWeekBasedYear';
3286
+ _proto.isStrict = function isStrict() {
3287
+ return this._strict;
3279
3288
  };
3280
- _proto4.baseUnit = function baseUnit() {
3281
- return ChronoUnit.WEEKS;
3289
+ _proto.setStrict = function setStrict(strict) {
3290
+ this._strict = strict;
3282
3291
  };
3283
- _proto4.rangeUnit = function rangeUnit() {
3284
- return WEEK_BASED_YEARS;
3292
+ _proto.locale = function locale() {
3293
+ return this._locale;
3285
3294
  };
3286
- _proto4.range = function range() {
3287
- return ValueRange.of(1, 52, 53);
3295
+ _proto.setLocale = function setLocale(locale) {
3296
+ this._locale = locale;
3288
3297
  };
3289
- _proto4.isSupportedBy = function isSupportedBy(temporal) {
3290
- return temporal.isSupported(ChronoField.EPOCH_DAY) && this._isIso(temporal);
3298
+ _proto.startOptional = function startOptional() {
3299
+ this._parsed.push(this.currentParsed().copy());
3291
3300
  };
3292
- _proto4.rangeRefinedBy = function rangeRefinedBy(temporal) {
3293
- if (temporal.isSupported(this) === false) {
3294
- throw new UnsupportedTemporalTypeException('Unsupported field: WeekOfWeekBasedYear');
3301
+ _proto.endOptional = function endOptional(successful) {
3302
+ if (successful) {
3303
+ this._parsed.splice(this._parsed.length - 2, 1);
3304
+ } else {
3305
+ this._parsed.splice(this._parsed.length - 1, 1);
3295
3306
  }
3296
- return Field._getWeekRangeByLocalDate(LocalDate.from(temporal));
3297
3307
  };
3298
- _proto4.getFrom = function getFrom(temporal) {
3299
- if (temporal.isSupported(this) === false) {
3300
- throw new UnsupportedTemporalTypeException('Unsupported field: WeekOfWeekBasedYear');
3301
- }
3302
- return Field._getWeek(LocalDate.from(temporal));
3308
+ _proto.isCaseSensitive = function isCaseSensitive() {
3309
+ return this._caseSensitive;
3303
3310
  };
3304
- _proto4.adjustInto = function adjustInto(temporal, newValue) {
3305
- this.range().checkValidValue(newValue, this);
3306
- return temporal.plus(MathUtil.safeSubtract(newValue, this.getFrom(temporal)), ChronoUnit.WEEKS);
3311
+ _proto.setCaseSensitive = function setCaseSensitive(caseSensitive) {
3312
+ this._caseSensitive = caseSensitive;
3307
3313
  };
3308
- _proto4.resolve = function resolve(fieldValues, partialTemporal, resolverStyle) {
3309
- var wbyLong = fieldValues.get(WEEK_BASED_YEAR);
3310
- var dowLong = fieldValues.get(ChronoField.DAY_OF_WEEK);
3311
- if (wbyLong == null || dowLong == null) {
3312
- return null;
3314
+ _proto.subSequenceEquals = function subSequenceEquals(cs1, offset1, cs2, offset2, length) {
3315
+ if (offset1 + length > cs1.length || offset2 + length > cs2.length) {
3316
+ return false;
3313
3317
  }
3314
- var wby = WEEK_BASED_YEAR.range().checkValidIntValue(wbyLong, WEEK_BASED_YEAR);
3315
- var wowby = fieldValues.get(WEEK_OF_WEEK_BASED_YEAR);
3316
- var date;
3317
- if (resolverStyle === ResolverStyle.LENIENT) {
3318
- var dow = dowLong;
3319
- var weeks = 0;
3320
- if (dow > 7) {
3321
- weeks = MathUtil.intDiv(dow - 1, 7);
3322
- dow = MathUtil.intMod(dow - 1, 7) + 1;
3323
- } else if (dow < 1) {
3324
- weeks = MathUtil.intDiv(dow, 7) - 1;
3325
- dow = MathUtil.intMod(dow, 7) + 7;
3326
- }
3327
- date = LocalDate.of(wby, 1, 4).plusWeeks(wowby - 1).plusWeeks(weeks).with(ChronoField.DAY_OF_WEEK, dow);
3328
- } else {
3329
- var _dow2 = ChronoField.DAY_OF_WEEK.checkValidIntValue(dowLong);
3330
- if (resolverStyle === ResolverStyle.STRICT) {
3331
- var temp = LocalDate.of(wby, 1, 4);
3332
- var range = Field._getWeekRangeByLocalDate(temp);
3333
- range.checkValidValue(wowby, this);
3334
- } else {
3335
- this.range().checkValidValue(wowby, this);
3318
+ if (!this.isCaseSensitive()) {
3319
+ cs1 = cs1.toLowerCase();
3320
+ cs2 = cs2.toLowerCase();
3321
+ }
3322
+ for (var i = 0; i < length; i++) {
3323
+ var ch1 = cs1[offset1 + i];
3324
+ var ch2 = cs2[offset2 + i];
3325
+ if (ch1 !== ch2) {
3326
+ return false;
3336
3327
  }
3337
- date = LocalDate.of(wby, 1, 4).plusWeeks(wowby - 1).with(ChronoField.DAY_OF_WEEK, _dow2);
3338
3328
  }
3339
- fieldValues.remove(this);
3340
- fieldValues.remove(WEEK_BASED_YEAR);
3341
- fieldValues.remove(ChronoField.DAY_OF_WEEK);
3342
- return date;
3343
- };
3344
- _proto4.displayName = function displayName() {
3345
- return 'Week';
3329
+ return true;
3346
3330
  };
3347
- return WEEK_OF_WEEK_BASED_YEAR_FIELD;
3348
- }(Field);
3349
- var WEEK_BASED_YEAR_FIELD = function (_Field4) {
3350
- function WEEK_BASED_YEAR_FIELD() {
3351
- return _Field4.apply(this, arguments) || this;
3352
- }
3353
- _inheritsLoose(WEEK_BASED_YEAR_FIELD, _Field4);
3354
- var _proto5 = WEEK_BASED_YEAR_FIELD.prototype;
3355
- _proto5.toString = function toString() {
3356
- return 'WeekBasedYear';
3331
+ _proto.charEquals = function charEquals(ch1, ch2) {
3332
+ if (this.isCaseSensitive()) {
3333
+ return ch1 === ch2;
3334
+ }
3335
+ return this.charEqualsIgnoreCase(ch1, ch2);
3357
3336
  };
3358
- _proto5.baseUnit = function baseUnit() {
3359
- return WEEK_BASED_YEARS;
3337
+ _proto.charEqualsIgnoreCase = function charEqualsIgnoreCase(c1, c2) {
3338
+ return c1 === c2 || c1.toLowerCase() === c2.toLowerCase();
3360
3339
  };
3361
- _proto5.rangeUnit = function rangeUnit() {
3362
- return ChronoUnit.FOREVER;
3340
+ _proto.setParsedField = function setParsedField(field, value, errorPos, successPos) {
3341
+ var currentParsedFieldValues = this.currentParsed().fieldValues;
3342
+ var old = currentParsedFieldValues.get(field);
3343
+ currentParsedFieldValues.set(field, value);
3344
+ return old != null && old !== value ? ~errorPos : successPos;
3363
3345
  };
3364
- _proto5.range = function range() {
3365
- return ChronoField.YEAR.range();
3346
+ _proto.setParsedZone = function setParsedZone(zone) {
3347
+ requireNonNull(zone, 'zone');
3348
+ this.currentParsed().zone = zone;
3366
3349
  };
3367
- _proto5.isSupportedBy = function isSupportedBy(temporal) {
3368
- return temporal.isSupported(ChronoField.EPOCH_DAY) && this._isIso(temporal);
3350
+ _proto.getParsed = function getParsed(field) {
3351
+ return this.currentParsed().fieldValues.get(field);
3369
3352
  };
3370
- _proto5.rangeRefinedBy = function rangeRefinedBy(temporal) {
3371
- return ChronoField.YEAR.range();
3353
+ _proto.toParsed = function toParsed() {
3354
+ return this.currentParsed();
3372
3355
  };
3373
- _proto5.getFrom = function getFrom(temporal) {
3374
- if (temporal.isSupported(this) === false) {
3375
- throw new UnsupportedTemporalTypeException('Unsupported field: WeekBasedYear');
3376
- }
3377
- return Field._getWeekBasedYear(LocalDate.from(temporal));
3356
+ _proto.currentParsed = function currentParsed() {
3357
+ return this._parsed[this._parsed.length - 1];
3378
3358
  };
3379
- _proto5.adjustInto = function adjustInto(temporal, newValue) {
3380
- if (this.isSupportedBy(temporal) === false) {
3381
- throw new UnsupportedTemporalTypeException('Unsupported field: WeekBasedYear');
3382
- }
3383
- var newWby = this.range().checkValidIntValue(newValue, WEEK_BASED_YEAR);
3384
- var date = LocalDate.from(temporal);
3385
- var dow = date.get(ChronoField.DAY_OF_WEEK);
3386
- var week = Field._getWeek(date);
3387
- if (week === 53 && Field._getWeekRangeByYear(newWby) === 52) {
3388
- week = 52;
3359
+ _proto.setParsedLeapSecond = function setParsedLeapSecond() {
3360
+ this.currentParsed().leapSecond = true;
3361
+ };
3362
+ _proto.getEffectiveChronology = function getEffectiveChronology() {
3363
+ var chrono = this.currentParsed().chrono;
3364
+ if (chrono == null) {
3365
+ chrono = this._overrideChronology;
3366
+ if (chrono == null) {
3367
+ chrono = IsoChronology.INSTANCE;
3368
+ }
3389
3369
  }
3390
- var resolved = LocalDate.of(newWby, 1, 4);
3391
- var days = dow - resolved.get(ChronoField.DAY_OF_WEEK) + (week - 1) * 7;
3392
- resolved = resolved.plusDays(days);
3393
- return temporal.with(resolved);
3370
+ return chrono;
3394
3371
  };
3395
- return WEEK_BASED_YEAR_FIELD;
3396
- }(Field);
3397
- var Unit = function (_TemporalUnit) {
3398
- function Unit(name, estimatedDuration) {
3372
+ return DateTimeParseContext;
3373
+ }();
3374
+ var Parsed = function (_Temporal) {
3375
+ function Parsed(dateTimeParseContext) {
3399
3376
  var _this;
3400
- _this = _TemporalUnit.call(this) || this;
3401
- _this._name = name;
3402
- _this._duration = estimatedDuration;
3377
+ _this = _Temporal.call(this) || this;
3378
+ _this.chrono = null;
3379
+ _this.zone = null;
3380
+ _this.fieldValues = new EnumMap();
3381
+ _this.leapSecond = false;
3382
+ _this.excessDays = Period.ZERO;
3383
+ _this.dateTimeParseContext = dateTimeParseContext;
3403
3384
  return _this;
3404
3385
  }
3405
- _inheritsLoose(Unit, _TemporalUnit);
3406
- var _proto6 = Unit.prototype;
3407
- _proto6.duration = function duration() {
3408
- return this._duration;
3386
+ _inheritsLoose(Parsed, _Temporal);
3387
+ var _proto2 = Parsed.prototype;
3388
+ _proto2.copy = function copy() {
3389
+ var cloned = new Parsed();
3390
+ cloned.chrono = this.chrono;
3391
+ cloned.zone = this.zone;
3392
+ cloned.fieldValues.putAll(this.fieldValues);
3393
+ cloned.leapSecond = this.leapSecond;
3394
+ cloned.dateTimeParseContext = this.dateTimeParseContext;
3395
+ return cloned;
3409
3396
  };
3410
- _proto6.isDurationEstimated = function isDurationEstimated() {
3411
- return true;
3397
+ _proto2.toString = function toString() {
3398
+ return this.fieldValues + ", " + this.chrono + ", " + this.zone;
3412
3399
  };
3413
- _proto6.isDateBased = function isDateBased() {
3414
- return true;
3400
+ _proto2.isSupported = function isSupported(field) {
3401
+ return this.fieldValues.containsKey(field);
3415
3402
  };
3416
- _proto6.isTimeBased = function isTimeBased() {
3417
- return false;
3403
+ _proto2.get = function get(field) {
3404
+ var val = this.fieldValues.get(field);
3405
+ assert(val != null);
3406
+ return val;
3418
3407
  };
3419
- _proto6.isSupportedBy = function isSupportedBy(temporal) {
3420
- return temporal.isSupported(ChronoField.EPOCH_DAY);
3408
+ _proto2.query = function query(_query) {
3409
+ if (_query === TemporalQueries.chronology()) {
3410
+ return this.chrono;
3411
+ }
3412
+ if (_query === TemporalQueries.zoneId() || _query === TemporalQueries.zone()) {
3413
+ return this.zone;
3414
+ }
3415
+ return _Temporal.prototype.query.call(this, _query);
3421
3416
  };
3422
- _proto6.addTo = function addTo(temporal, periodToAdd) {
3423
- switch (this) {
3424
- case WEEK_BASED_YEARS:
3425
- {
3426
- var added = MathUtil.safeAdd(temporal.get(WEEK_BASED_YEAR), periodToAdd);
3427
- return temporal.with(WEEK_BASED_YEAR, added);
3428
- }
3429
- case QUARTER_YEARS:
3430
- return temporal.plus(MathUtil.intDiv(periodToAdd, 256), ChronoUnit.YEARS).plus(MathUtil.intMod(periodToAdd, 256) * 3, ChronoUnit.MONTHS);
3431
- default:
3432
- throw new IllegalStateException('Unreachable');
3417
+ _proto2.toBuilder = function toBuilder() {
3418
+ var builder = new DateTimeBuilder();
3419
+ builder.fieldValues.putAll(this.fieldValues);
3420
+ builder.chrono = this.dateTimeParseContext.getEffectiveChronology();
3421
+ if (this.zone != null) {
3422
+ builder.zone = this.zone;
3423
+ } else {
3424
+ builder.zone = this.overrideZone;
3433
3425
  }
3426
+ builder.leapSecond = this.leapSecond;
3427
+ builder.excessDays = this.excessDays;
3428
+ return builder;
3434
3429
  };
3435
- _proto6.between = function between(temporal1, temporal2) {
3436
- switch (this) {
3437
- case WEEK_BASED_YEARS:
3438
- return MathUtil.safeSubtract(temporal2.getLong(WEEK_BASED_YEAR), temporal1.getLong(WEEK_BASED_YEAR));
3439
- case QUARTER_YEARS:
3440
- return MathUtil.intDiv(temporal1.until(temporal2, ChronoUnit.MONTHS), 3);
3441
- default:
3442
- throw new IllegalStateException('Unreachable');
3430
+ return Parsed;
3431
+ }(Temporal);
3432
+
3433
+ /*
3434
+ * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
3435
+ * @copyright (c) 2007-present, Stephen Colebourne & Michael Nascimento Santos
3436
+ * @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
3437
+ */
3438
+
3439
+ var DateTimePrintContext = function () {
3440
+ function DateTimePrintContext(temporal, localeOrFormatter, symbols) {
3441
+ if (arguments.length === 2 && arguments[1] instanceof DateTimeFormatter) {
3442
+ this._temporal = DateTimePrintContext.adjust(temporal, localeOrFormatter);
3443
+ this._locale = localeOrFormatter.locale();
3444
+ this._symbols = localeOrFormatter.decimalStyle();
3445
+ } else {
3446
+ this._temporal = temporal;
3447
+ this._locale = localeOrFormatter;
3448
+ this._symbols = symbols;
3443
3449
  }
3450
+ this._optional = 0;
3451
+ }
3452
+ DateTimePrintContext.adjust = function adjust(temporal, formatter) {
3453
+ return temporal;
3444
3454
  };
3445
- _proto6.toString = function toString() {
3446
- return this._name;
3455
+ var _proto = DateTimePrintContext.prototype;
3456
+ _proto.symbols = function symbols() {
3457
+ return this._symbols;
3447
3458
  };
3448
- return Unit;
3449
- }(TemporalUnit);
3450
- var DAY_OF_QUARTER = null;
3451
- var QUARTER_OF_YEAR = null;
3452
- var WEEK_OF_WEEK_BASED_YEAR = null;
3453
- var WEEK_BASED_YEAR = null;
3454
- var WEEK_BASED_YEARS = null;
3455
- var QUARTER_YEARS = null;
3456
- function _init$f() {
3457
- DAY_OF_QUARTER = new DAY_OF_QUARTER_FIELD();
3458
- QUARTER_OF_YEAR = new QUARTER_OF_YEAR_FIELD();
3459
- WEEK_OF_WEEK_BASED_YEAR = new WEEK_OF_WEEK_BASED_YEAR_FIELD();
3460
- WEEK_BASED_YEAR = new WEEK_BASED_YEAR_FIELD();
3461
- WEEK_BASED_YEARS = new Unit('WeekBasedYears', Duration.ofSeconds(31556952));
3462
- QUARTER_YEARS = new Unit('QuarterYears', Duration.ofSeconds(31556952 / 4));
3463
- IsoFields.DAY_OF_QUARTER = DAY_OF_QUARTER;
3464
- IsoFields.QUARTER_OF_YEAR = QUARTER_OF_YEAR;
3465
- IsoFields.WEEK_OF_WEEK_BASED_YEAR = WEEK_OF_WEEK_BASED_YEAR;
3466
- IsoFields.WEEK_BASED_YEAR = WEEK_BASED_YEAR;
3467
- IsoFields.WEEK_BASED_YEARS = WEEK_BASED_YEARS;
3468
- IsoFields.QUARTER_YEARS = QUARTER_YEARS;
3469
- LocalDate.prototype.isoWeekOfWeekyear = function () {
3470
- return this.get(IsoFields.WEEK_OF_WEEK_BASED_YEAR);
3459
+ _proto.startOptional = function startOptional() {
3460
+ this._optional++;
3471
3461
  };
3472
- LocalDate.prototype.isoWeekyear = function () {
3473
- return this.get(IsoFields.WEEK_BASED_YEAR);
3462
+ _proto.endOptional = function endOptional() {
3463
+ this._optional--;
3474
3464
  };
3475
- }
3465
+ _proto.getValueQuery = function getValueQuery(query) {
3466
+ var result = this._temporal.query(query);
3467
+ if (result == null && this._optional === 0) {
3468
+ throw new DateTimeException("Unable to extract value: " + this._temporal);
3469
+ }
3470
+ return result;
3471
+ };
3472
+ _proto.getValue = function getValue(field) {
3473
+ try {
3474
+ return this._temporal.getLong(field);
3475
+ } catch (ex) {
3476
+ if (ex instanceof DateTimeException && this._optional > 0) {
3477
+ return null;
3478
+ }
3479
+ throw ex;
3480
+ }
3481
+ };
3482
+ _proto.temporal = function temporal() {
3483
+ return this._temporal;
3484
+ };
3485
+ _proto.locale = function locale() {
3486
+ return this._locale;
3487
+ };
3488
+ _proto.setDateTime = function setDateTime(temporal) {
3489
+ this._temporal = temporal;
3490
+ };
3491
+ _proto.setLocale = function setLocale(locale) {
3492
+ this._locale = locale;
3493
+ };
3494
+ return DateTimePrintContext;
3495
+ }();
3476
3496
 
3477
3497
  /**
3478
3498
  * @copyright (c) 2016, Philipp Thürwächter & Pattrick Hüper
@@ -5524,7 +5544,7 @@
5524
5544
  DateTimeFormatter.ISO_OFFSET_DATE = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_DATE).appendOffsetId().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
5525
5545
  DateTimeFormatter.ISO_OFFSET_TIME = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_TIME).appendOffsetId().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
5526
5546
  DateTimeFormatter.ISO_ORDINAL_DATE = new DateTimeFormatterBuilder().appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendLiteral('-').appendValue(ChronoField.DAY_OF_YEAR).toFormatter(ResolverStyle.STRICT);
5527
- DateTimeFormatter.ISO_WEEK_DATE = new DateTimeFormatterBuilder().appendValue(ChronoField.YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendLiteral('-W').appendValue(ChronoField.ALIGNED_WEEK_OF_YEAR).appendLiteral('-').appendValue(ChronoField.DAY_OF_WEEK).toFormatter(ResolverStyle.STRICT);
5547
+ DateTimeFormatter.ISO_WEEK_DATE = new DateTimeFormatterBuilder().parseCaseInsensitive().appendValue(IsoFields.WEEK_BASED_YEAR, 4, 10, SignStyle.EXCEEDS_PAD).appendLiteral('-W').appendValue(IsoFields.WEEK_OF_WEEK_BASED_YEAR, 2).appendLiteral('-').appendValue(ChronoField.DAY_OF_WEEK, 1).toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
5528
5548
  DateTimeFormatter.ISO_DATE = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_DATE).optionalStart().appendOffsetId().optionalEnd().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
5529
5549
  DateTimeFormatter.ISO_TIME = new DateTimeFormatterBuilder().parseCaseInsensitive().append(DateTimeFormatter.ISO_LOCAL_TIME).optionalStart().appendOffsetId().optionalEnd().toFormatter(ResolverStyle.STRICT);
5530
5550
  DateTimeFormatter.ISO_DATE_TIME = new DateTimeFormatterBuilder().append(DateTimeFormatter.ISO_LOCAL_DATE_TIME).optionalStart().appendOffsetId().optionalEnd().toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
@@ -9808,8 +9828,16 @@
9808
9828
  };
9809
9829
  _proto._microsUntil = function _microsUntil(end) {
9810
9830
  var secsDiff = MathUtil.safeSubtract(end.epochSecond(), this.epochSecond());
9831
+ var nanosDiff = end.nano() - this.nano();
9832
+ if (secsDiff > 0 && nanosDiff < 0) {
9833
+ secsDiff--;
9834
+ nanosDiff += LocalTime.NANOS_PER_SECOND;
9835
+ } else if (secsDiff < 0 && nanosDiff > 0) {
9836
+ secsDiff++;
9837
+ nanosDiff -= LocalTime.NANOS_PER_SECOND;
9838
+ }
9811
9839
  var totalMicros = MathUtil.safeMultiply(secsDiff, 1000000);
9812
- return MathUtil.safeAdd(totalMicros, MathUtil.intDiv(end.nano() - this.nano(), 1000));
9840
+ return MathUtil.safeAdd(totalMicros, MathUtil.intDiv(nanosDiff, 1000));
9813
9841
  };
9814
9842
  _proto._nanosUntil = function _nanosUntil(end) {
9815
9843
  var secsDiff = MathUtil.safeSubtract(end.epochSecond(), this.epochSecond());
@@ -10348,7 +10376,7 @@
10348
10376
  _init$l();
10349
10377
  _init$k();
10350
10378
  _init$3();
10351
- _init$f();
10379
+ _init$g();
10352
10380
  _init$1();
10353
10381
  _init$j();
10354
10382
  _init$2();
@@ -10359,7 +10387,7 @@
10359
10387
  _init$b();
10360
10388
  _init$c();
10361
10389
  _init$h();
10362
- _init$g();
10390
+ _init$f();
10363
10391
  _init$7();
10364
10392
  _init();
10365
10393
  _init$9();