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