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