@js-joda/core 4.1.0 → 4.3.1
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/CHANGELOG.md +16 -1
- package/README.md +42 -32
- package/dist/js-joda.esm.js +11345 -9928
- package/dist/js-joda.js +11345 -9928
- package/dist/js-joda.js.map +1 -1
- package/dist/js-joda.min.js +2 -2
- package/package.json +22 -46
- package/src/Clock.js +6 -6
- package/src/DayOfWeek.js +13 -13
- package/src/Duration.js +15 -15
- package/src/Instant.js +21 -21
- package/src/LocalDate.js +44 -44
- package/src/LocalDateTime.js +19 -19
- package/src/LocalTime.js +21 -21
- package/src/MathUtil.js +3 -3
- package/src/Month.js +12 -12
- package/src/MonthDay.js +23 -23
- package/src/OffsetDateTime.js +21 -21
- package/src/OffsetTime.js +16 -16
- package/src/Period.js +12 -12
- package/src/StringUtil.js +1 -1
- package/src/Year.js +30 -30
- package/src/YearMonth.js +26 -26
- package/src/ZoneId.js +7 -7
- package/src/ZoneIdFactory.js +13 -13
- package/src/ZoneOffset.js +20 -20
- package/src/ZoneRegion.js +2 -2
- package/src/ZonedDateTime.js +24 -24
- package/src/_init.js +24 -24
- package/src/assert.js +4 -4
- package/src/chrono/ChronoLocalDate.js +7 -7
- package/src/chrono/ChronoLocalDateTime.js +9 -9
- package/src/chrono/ChronoZonedDateTime.js +7 -7
- package/src/chrono/IsoChronology.js +13 -13
- package/src/convert.js +7 -7
- package/src/errors.js +3 -3
- package/src/format/DateTimeBuilder.js +17 -17
- package/src/format/DateTimeFormatter.js +19 -19
- package/src/format/DateTimeFormatterBuilder.js +59 -59
- package/src/format/DateTimeParseContext.js +6 -6
- package/src/format/DateTimePrintContext.js +3 -3
- package/src/format/DecimalStyle.js +1 -1
- package/src/format/ResolverStyle.js +1 -1
- package/src/format/SignStyle.js +1 -1
- package/src/format/TextStyle.js +1 -1
- package/src/format/parser/CharLiteralPrinterParser.js +3 -3
- package/src/format/parser/FractionPrinterParser.js +9 -9
- package/src/format/parser/NumberPrinterParser.js +17 -17
- package/src/format/parser/OffsetIdPrinterParser.js +9 -9
- package/src/format/parser/PadPrinterParserDecorator.js +3 -3
- package/src/format/parser/StringLiteralPrinterParser.js +2 -2
- package/src/format/parser/ZoneIdPrinterParser.js +5 -5
- package/src/temporal/ChronoField.js +5 -5
- package/src/temporal/ChronoUnit.js +4 -4
- package/src/temporal/IsoFields.js +12 -12
- package/src/temporal/NativeJsTemporal.js +11 -11
- package/src/temporal/Temporal.js +5 -5
- package/src/temporal/TemporalAccessor.js +5 -5
- package/src/temporal/TemporalAdjuster.js +1 -1
- package/src/temporal/TemporalAdjusters.js +6 -6
- package/src/temporal/TemporalAmount.js +1 -1
- package/src/temporal/TemporalQueriesFactory.js +6 -6
- package/src/temporal/TemporalQuery.js +2 -2
- package/src/temporal/TemporalUnit.js +1 -1
- package/src/temporal/ValueRange.js +15 -15
- package/src/zone/SystemDefaultZoneId.js +2 -2
- package/src/zone/SystemDefaultZoneRules.js +3 -3
- package/src/zone/ZoneOffsetTransition.js +7 -7
- package/src/zone/ZoneRules.js +4 -4
- package/src/zone/ZoneRulesProvider.js +2 -2
- package/{dist → typings}/js-joda.d.ts +0 -0
- package/{dist → typings}/js-joda.flow.js +1 -1
- package/CheatSheet.md +0 -947
- package/bower.json +0 -21
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {requireNonNull} from '../../assert';
|
|
8
|
-
import {IllegalArgumentException} from '../../errors';
|
|
9
|
-
import {MathUtil} from '../../MathUtil';
|
|
7
|
+
import { requireNonNull } from '../../assert';
|
|
8
|
+
import { IllegalArgumentException } from '../../errors';
|
|
9
|
+
import { MathUtil } from '../../MathUtil';
|
|
10
10
|
|
|
11
|
-
import {ChronoField} from '../../temporal/ChronoField';
|
|
11
|
+
import { ChronoField } from '../../temporal/ChronoField';
|
|
12
12
|
|
|
13
13
|
//-----------------------------------------------------------------------
|
|
14
14
|
const PATTERNS = [
|
|
@@ -43,7 +43,7 @@ export class OffsetIdPrinterParser {
|
|
|
43
43
|
return i;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
throw new IllegalArgumentException(`Invalid zone offset pattern: ${
|
|
46
|
+
throw new IllegalArgumentException(`Invalid zone offset pattern: ${pattern}`);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
@@ -66,14 +66,14 @@ export class OffsetIdPrinterParser {
|
|
|
66
66
|
const bufPos = buf.length();
|
|
67
67
|
let output = absHours;
|
|
68
68
|
buf.append(totalSecs < 0 ? '-' : '+')
|
|
69
|
-
.appendChar((`${MathUtil.intDiv(absHours, 10)
|
|
69
|
+
.appendChar((`${MathUtil.intDiv(absHours, 10)}0`)).appendChar(`${MathUtil.intMod(absHours, 10)}0`);
|
|
70
70
|
if (this.type >= 3 || (this.type >= 1 && absMinutes > 0)) {
|
|
71
71
|
buf.append((this.type % 2) === 0 ? ':' : '')
|
|
72
|
-
.appendChar((`${MathUtil.intDiv(absMinutes, 10)
|
|
72
|
+
.appendChar((`${MathUtil.intDiv(absMinutes, 10)}0`)).appendChar((`${absMinutes % 10}0`));
|
|
73
73
|
output += absMinutes;
|
|
74
74
|
if (this.type >= 7 || (this.type >= 5 && absSeconds > 0)) {
|
|
75
75
|
buf.append((this.type % 2) === 0 ? ':' : '')
|
|
76
|
-
.appendChar((`${MathUtil.intDiv(absSeconds, 10)
|
|
76
|
+
.appendChar((`${MathUtil.intDiv(absSeconds, 10)}0`)).appendChar((`${absSeconds % 10}0`));
|
|
77
77
|
output += absSeconds;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -169,7 +169,7 @@ export class OffsetIdPrinterParser {
|
|
|
169
169
|
|
|
170
170
|
toString() {
|
|
171
171
|
const converted = this.noOffsetText.replace('\'', '\'\'');
|
|
172
|
-
return `Offset(${
|
|
172
|
+
return `Offset(${PATTERNS[this.type]},'${converted}')`;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
OffsetIdPrinterParser.INSTANCE_ID = new OffsetIdPrinterParser('Z', '+HH:MM:ss');
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {assert} from '../../assert';
|
|
7
|
+
import { assert } from '../../assert';
|
|
8
8
|
|
|
9
|
-
import {DateTimeException} from '../../errors';
|
|
9
|
+
import { DateTimeException } from '../../errors';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Pads the output to a fixed width.
|
|
@@ -75,7 +75,7 @@ export class PadPrinterParserDecorator {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
toString() {
|
|
78
|
-
return `Pad(${this._printerParser},${this._padWidth}${(this._padChar === ' ' ? ')' : `,'${
|
|
78
|
+
return `Pad(${this._printerParser},${this._padWidth}${(this._padChar === ' ' ? ')' : `,'${this._padChar}')`)}`;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {assert} from '../../assert';
|
|
7
|
+
import { assert } from '../../assert';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Prints or parses a string literal.
|
|
@@ -33,7 +33,7 @@ export class StringLiteralPrinterParser {
|
|
|
33
33
|
|
|
34
34
|
toString() {
|
|
35
35
|
const converted = this._literal.replace("'", "''");
|
|
36
|
-
return `'${
|
|
36
|
+
return `'${converted}'`;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {ZoneOffset} from '../../ZoneOffset';
|
|
8
|
-
import {ZoneId} from '../../ZoneId';
|
|
9
|
-
import {ZoneRegion} from '../../ZoneRegion';
|
|
7
|
+
import { ZoneOffset } from '../../ZoneOffset';
|
|
8
|
+
import { ZoneId } from '../../ZoneId';
|
|
9
|
+
import { ZoneRegion } from '../../ZoneRegion';
|
|
10
10
|
|
|
11
|
-
import {ChronoField} from '../../temporal/ChronoField';
|
|
11
|
+
import { ChronoField } from '../../temporal/ChronoField';
|
|
12
12
|
|
|
13
13
|
import { ZoneRulesProvider } from '../../zone/ZoneRulesProvider';
|
|
14
14
|
|
|
15
|
-
import {OffsetIdPrinterParser} from './OffsetIdPrinterParser';
|
|
15
|
+
import { OffsetIdPrinterParser } from './OffsetIdPrinterParser';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Prints or parses a zone ID.
|
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {MAX_SAFE_INTEGER, MIN_SAFE_INTEGER} from '../MathUtil';
|
|
7
|
+
import { MAX_SAFE_INTEGER, MIN_SAFE_INTEGER } from '../MathUtil';
|
|
8
8
|
|
|
9
|
-
import {ChronoUnit} from './ChronoUnit';
|
|
10
|
-
import {TemporalField} from './TemporalField';
|
|
11
|
-
import {ValueRange} from './ValueRange';
|
|
12
|
-
import {YearConstants} from '../YearConstants';
|
|
9
|
+
import { ChronoUnit } from './ChronoUnit';
|
|
10
|
+
import { TemporalField } from './TemporalField';
|
|
11
|
+
import { ValueRange } from './ValueRange';
|
|
12
|
+
import { YearConstants } from '../YearConstants';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* A standard set of fields.
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {MathUtil} from '../MathUtil';
|
|
7
|
+
import { MathUtil } from '../MathUtil';
|
|
8
8
|
|
|
9
|
-
import {Duration} from '../Duration';
|
|
10
|
-
import {YearConstants} from '../YearConstants';
|
|
11
|
-
import {TemporalUnit} from './TemporalUnit';
|
|
9
|
+
import { Duration } from '../Duration';
|
|
10
|
+
import { YearConstants } from '../YearConstants';
|
|
11
|
+
import { TemporalUnit } from './TemporalUnit';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* A standard set of date periods units.
|
|
@@ -4,22 +4,22 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {UnsupportedTemporalTypeException, IllegalStateException} from '../errors';
|
|
7
|
+
import { UnsupportedTemporalTypeException, IllegalStateException } from '../errors';
|
|
8
8
|
|
|
9
|
-
import {DayOfWeek} from '../DayOfWeek';
|
|
10
|
-
import {Duration} from '../Duration';
|
|
11
|
-
import {MathUtil} from '../MathUtil';
|
|
12
|
-
import {LocalDate} from '../LocalDate';
|
|
9
|
+
import { DayOfWeek } from '../DayOfWeek';
|
|
10
|
+
import { Duration } from '../Duration';
|
|
11
|
+
import { MathUtil } from '../MathUtil';
|
|
12
|
+
import { LocalDate } from '../LocalDate';
|
|
13
13
|
|
|
14
|
-
import {ChronoField} from './ChronoField';
|
|
15
|
-
import {ChronoUnit} from './ChronoUnit';
|
|
16
|
-
import {TemporalField} from './TemporalField';
|
|
17
|
-
import {TemporalUnit} from './TemporalUnit';
|
|
18
|
-
import {ValueRange} from './ValueRange';
|
|
14
|
+
import { ChronoField } from './ChronoField';
|
|
15
|
+
import { ChronoUnit } from './ChronoUnit';
|
|
16
|
+
import { TemporalField } from './TemporalField';
|
|
17
|
+
import { TemporalUnit } from './TemporalUnit';
|
|
18
|
+
import { ValueRange } from './ValueRange';
|
|
19
19
|
|
|
20
|
-
import {IsoChronology} from '../chrono/IsoChronology';
|
|
20
|
+
import { IsoChronology } from '../chrono/IsoChronology';
|
|
21
21
|
|
|
22
|
-
import {ResolverStyle} from '../format/ResolverStyle';
|
|
22
|
+
import { ResolverStyle } from '../format/ResolverStyle';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Fields and units specific to the ISO-8601 calendar system,
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {assert, requireNonNull} from '../assert';
|
|
7
|
-
import {UnsupportedTemporalTypeException} from '../errors';
|
|
6
|
+
import { assert, requireNonNull } from '../assert';
|
|
7
|
+
import { UnsupportedTemporalTypeException } from '../errors';
|
|
8
8
|
|
|
9
|
-
import {Instant} from '../Instant';
|
|
10
|
-
import {LocalDate} from '../LocalDate';
|
|
11
|
-
import {LocalTime} from '../LocalTime';
|
|
12
|
-
import {MathUtil} from '../MathUtil';
|
|
13
|
-
import {ZoneId} from '../ZoneId';
|
|
9
|
+
import { Instant } from '../Instant';
|
|
10
|
+
import { LocalDate } from '../LocalDate';
|
|
11
|
+
import { LocalTime } from '../LocalTime';
|
|
12
|
+
import { MathUtil } from '../MathUtil';
|
|
13
|
+
import { ZoneId } from '../ZoneId';
|
|
14
14
|
|
|
15
|
-
import {ChronoField} from './ChronoField';
|
|
16
|
-
import {TemporalQueries} from './TemporalQueries';
|
|
17
|
-
import {TemporalAccessor} from './TemporalAccessor';
|
|
15
|
+
import { ChronoField } from './ChronoField';
|
|
16
|
+
import { TemporalQueries } from './TemporalQueries';
|
|
17
|
+
import { TemporalAccessor } from './TemporalAccessor';
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* A wrapper around a native javascript Date instance that
|
|
@@ -79,7 +79,7 @@ class NativeJsTemporal extends TemporalAccessor {
|
|
|
79
79
|
case ChronoField.NANO_OF_SECOND: return MathUtil.floorMod(this._epochMilli, 1000) * 1000000;
|
|
80
80
|
case ChronoField.INSTANT_SECONDS: return MathUtil.floorDiv(this._epochMilli, 1000);
|
|
81
81
|
}
|
|
82
|
-
throw new UnsupportedTemporalTypeException(`Unsupported field: ${
|
|
82
|
+
throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
|
|
83
83
|
}
|
|
84
84
|
return field.getFrom(this);
|
|
85
85
|
}
|
package/src/temporal/Temporal.js
CHANGED
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {assert, abstractMethodFail, requireInstance, requireNonNull} from '../assert';
|
|
8
|
-
import {IllegalArgumentException} from '../errors';
|
|
9
|
-
import {TemporalAccessor} from './TemporalAccessor';
|
|
10
|
-
import {TemporalAmount} from './TemporalAmount';
|
|
11
|
-
import {TemporalUnit} from './TemporalUnit';
|
|
7
|
+
import { assert, abstractMethodFail, requireInstance, requireNonNull } from '../assert';
|
|
8
|
+
import { IllegalArgumentException } from '../errors';
|
|
9
|
+
import { TemporalAccessor } from './TemporalAccessor';
|
|
10
|
+
import { TemporalAmount } from './TemporalAmount';
|
|
11
|
+
import { TemporalUnit } from './TemporalUnit';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Framework-level interface defining read-write access to a temporal object,
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {UnsupportedTemporalTypeException} from '../errors';
|
|
8
|
-
import {abstractMethodFail} from '../assert';
|
|
7
|
+
import { UnsupportedTemporalTypeException } from '../errors';
|
|
8
|
+
import { abstractMethodFail } from '../assert';
|
|
9
9
|
|
|
10
|
-
import {ChronoField} from './ChronoField';
|
|
11
|
-
import {TemporalQueries} from './TemporalQueries';
|
|
10
|
+
import { ChronoField } from './ChronoField';
|
|
11
|
+
import { TemporalQueries } from './TemporalQueries';
|
|
12
12
|
|
|
13
13
|
export class TemporalAccessor {
|
|
14
14
|
/**
|
|
@@ -123,7 +123,7 @@ export class TemporalAccessor {
|
|
|
123
123
|
if (this.isSupported(field)) {
|
|
124
124
|
return field.range();
|
|
125
125
|
}
|
|
126
|
-
throw new UnsupportedTemporalTypeException(`Unsupported field: ${
|
|
126
|
+
throw new UnsupportedTemporalTypeException(`Unsupported field: ${field}`);
|
|
127
127
|
}
|
|
128
128
|
return field.rangeRefinedBy(this);
|
|
129
129
|
}
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {requireNonNull} from '../assert';
|
|
8
|
-
import {IllegalStateException} from '../errors';
|
|
7
|
+
import { requireNonNull } from '../assert';
|
|
8
|
+
import { IllegalStateException } from '../errors';
|
|
9
9
|
|
|
10
|
-
import {TemporalAdjuster} from './TemporalAdjuster';
|
|
11
|
-
import {ChronoField} from '../temporal/ChronoField';
|
|
12
|
-
import {ChronoUnit} from '../temporal/ChronoUnit';
|
|
13
|
-
import {MathUtil} from '../MathUtil';
|
|
10
|
+
import { TemporalAdjuster } from './TemporalAdjuster';
|
|
11
|
+
import { ChronoField } from '../temporal/ChronoField';
|
|
12
|
+
import { ChronoUnit } from '../temporal/ChronoUnit';
|
|
13
|
+
import { MathUtil } from '../MathUtil';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Common implementations of {@link TemporalAdjuster}.
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {ChronoField} from './ChronoField';
|
|
8
|
-
import {createTemporalQuery} from './TemporalQuery';
|
|
9
|
-
import {TemporalQueries} from './TemporalQueries';
|
|
7
|
+
import { ChronoField } from './ChronoField';
|
|
8
|
+
import { createTemporalQuery } from './TemporalQuery';
|
|
9
|
+
import { TemporalQueries } from './TemporalQueries';
|
|
10
10
|
|
|
11
|
-
import {LocalDate} from '../LocalDate';
|
|
12
|
-
import {LocalTime} from '../LocalTime';
|
|
13
|
-
import {ZoneOffset} from '../ZoneOffset';
|
|
11
|
+
import { LocalDate } from '../LocalDate';
|
|
12
|
+
import { LocalTime } from '../LocalTime';
|
|
13
|
+
import { ZoneOffset } from '../ZoneOffset';
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
export function _init() {
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {abstractMethodFail} from '../assert';
|
|
8
|
-
import {Enum} from '../Enum';
|
|
7
|
+
import { abstractMethodFail } from '../assert';
|
|
8
|
+
import { Enum } from '../Enum';
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {assert} from '../assert';
|
|
8
|
-
import {DateTimeException, IllegalArgumentException} from '../errors';
|
|
9
|
-
import {MathUtil} from '../MathUtil';
|
|
7
|
+
import { assert } from '../assert';
|
|
8
|
+
import { DateTimeException, IllegalArgumentException } from '../errors';
|
|
9
|
+
import { MathUtil } from '../MathUtil';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* The range of valid values for a date-time field.
|
|
@@ -34,12 +34,12 @@ export class ValueRange {
|
|
|
34
34
|
* @private
|
|
35
35
|
*/
|
|
36
36
|
constructor(minSmallest, minLargest, maxSmallest, maxLargest) {
|
|
37
|
-
assert(!(minSmallest > minLargest), `Smallest minimum value '${
|
|
38
|
-
}' must be less than largest minimum value '${
|
|
39
|
-
assert(!(maxSmallest > maxLargest), `Smallest maximum value '${
|
|
40
|
-
}' must be less than largest maximum value '${
|
|
41
|
-
assert(!(minLargest > maxLargest), `Minimum value '${
|
|
42
|
-
}' must be less than maximum value '${
|
|
37
|
+
assert(!(minSmallest > minLargest), `Smallest minimum value '${minSmallest
|
|
38
|
+
}' must be less than largest minimum value '${minLargest}'`, IllegalArgumentException);
|
|
39
|
+
assert(!(maxSmallest > maxLargest), `Smallest maximum value '${maxSmallest
|
|
40
|
+
}' must be less than largest maximum value '${maxLargest}'`, IllegalArgumentException);
|
|
41
|
+
assert(!(minLargest > maxLargest), `Minimum value '${minLargest
|
|
42
|
+
}' must be less than maximum value '${maxLargest}'`, IllegalArgumentException);
|
|
43
43
|
|
|
44
44
|
this._minSmallest = minSmallest;
|
|
45
45
|
this._minLargest = minLargest;
|
|
@@ -109,9 +109,9 @@ export class ValueRange {
|
|
|
109
109
|
let msg;
|
|
110
110
|
if (!this.isValidValue(value)) {
|
|
111
111
|
if (field != null) {
|
|
112
|
-
msg = `Invalid value for ${
|
|
112
|
+
msg = `Invalid value for ${field} (valid values ${this.toString()}): ${value}`;
|
|
113
113
|
} else {
|
|
114
|
-
msg = `Invalid value (valid values ${
|
|
114
|
+
msg = `Invalid value (valid values ${this.toString()}): ${value}`;
|
|
115
115
|
}
|
|
116
116
|
return assert(false, msg, DateTimeException);
|
|
117
117
|
}
|
|
@@ -132,7 +132,7 @@ export class ValueRange {
|
|
|
132
132
|
*/
|
|
133
133
|
checkValidIntValue(value, field) {
|
|
134
134
|
if (this.isValidIntValue(value) === false) {
|
|
135
|
-
throw new DateTimeException(`Invalid int value for ${
|
|
135
|
+
throw new DateTimeException(`Invalid int value for ${field}: ${value}`);
|
|
136
136
|
}
|
|
137
137
|
return value;
|
|
138
138
|
}
|
|
@@ -206,9 +206,9 @@ export class ValueRange {
|
|
|
206
206
|
* @return {string} a string representation of this range, not null
|
|
207
207
|
*/
|
|
208
208
|
toString() {
|
|
209
|
-
let str = this.minimum() + (this.minimum() !== this.largestMinimum() ? `/${
|
|
209
|
+
let str = this.minimum() + (this.minimum() !== this.largestMinimum() ? `/${this.largestMinimum()}` : '');
|
|
210
210
|
str += ' - ';
|
|
211
|
-
str += this.smallestMaximum() + (this.smallestMaximum() !== this.maximum() ? `/${
|
|
211
|
+
str += this.smallestMaximum() + (this.smallestMaximum() !== this.maximum() ? `/${this.maximum()}` : '');
|
|
212
212
|
return str;
|
|
213
213
|
}
|
|
214
214
|
|
|
@@ -251,7 +251,7 @@ export class ValueRange {
|
|
|
251
251
|
} else if (arguments.length === 4) {
|
|
252
252
|
return new ValueRange(arguments[0], arguments[1], arguments[2], arguments[3]);
|
|
253
253
|
} else {
|
|
254
|
-
return assert(false, `Invalid number of arguments ${
|
|
254
|
+
return assert(false, `Invalid number of arguments ${arguments.length}`, IllegalArgumentException);
|
|
255
255
|
}
|
|
256
256
|
}
|
|
257
257
|
}
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {SystemDefaultZoneRules} from './SystemDefaultZoneRules';
|
|
7
|
-
import {ZoneId} from '../ZoneId';
|
|
6
|
+
import { SystemDefaultZoneRules } from './SystemDefaultZoneRules';
|
|
7
|
+
import { ZoneId } from '../ZoneId';
|
|
8
8
|
|
|
9
9
|
export class SystemDefaultZoneId extends ZoneId {
|
|
10
10
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {ZoneRules} from './ZoneRules';
|
|
7
|
-
import {ZoneOffset} from '../ZoneOffset';
|
|
8
|
-
import {DateTimeException} from '../errors';
|
|
6
|
+
import { ZoneRules } from './ZoneRules';
|
|
7
|
+
import { ZoneOffset } from '../ZoneOffset';
|
|
8
|
+
import { DateTimeException } from '../errors';
|
|
9
9
|
|
|
10
10
|
export class SystemDefaultZoneRules extends ZoneRules {
|
|
11
11
|
|
|
@@ -4,11 +4,11 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {requireNonNull} from '../assert';
|
|
8
|
-
import {IllegalArgumentException} from '../errors';
|
|
7
|
+
import { requireNonNull } from '../assert';
|
|
8
|
+
import { IllegalArgumentException } from '../errors';
|
|
9
9
|
|
|
10
|
-
import {Duration} from '../Duration';
|
|
11
|
-
import {LocalDateTime} from '../LocalDateTime';
|
|
10
|
+
import { Duration } from '../Duration';
|
|
11
|
+
import { LocalDateTime } from '../LocalDateTime';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* A transition between two offsets caused by a discontinuity in the local time-line.
|
|
@@ -281,9 +281,9 @@ export class ZoneOffsetTransition {
|
|
|
281
281
|
* @return {string} a string for debugging, not null
|
|
282
282
|
*/
|
|
283
283
|
toString() {
|
|
284
|
-
return `Transition[${
|
|
285
|
-
} at ${
|
|
286
|
-
} to ${
|
|
284
|
+
return `Transition[${this.isGap() ? 'Gap' : 'Overlap'
|
|
285
|
+
} at ${this._transition.toString()}${this._offsetBefore.toString()
|
|
286
|
+
} to ${this._offsetAfter}]`;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
}
|
package/src/zone/ZoneRules.js
CHANGED
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {requireNonNull, abstractMethodFail} from '../assert';
|
|
7
|
+
import { requireNonNull, abstractMethodFail } from '../assert';
|
|
8
8
|
|
|
9
|
-
import {Duration} from '../Duration';
|
|
10
|
-
import {Instant} from '../Instant';
|
|
9
|
+
import { Duration } from '../Duration';
|
|
10
|
+
import { Instant } from '../Instant';
|
|
11
11
|
|
|
12
12
|
export class ZoneRules {
|
|
13
13
|
|
|
@@ -458,7 +458,7 @@ class Fixed extends ZoneRules{
|
|
|
458
458
|
* @returns {string}
|
|
459
459
|
*/
|
|
460
460
|
toString() {
|
|
461
|
-
return `FixedRules:${
|
|
461
|
+
return `FixedRules:${this._offset.toString()}`;
|
|
462
462
|
}
|
|
463
463
|
|
|
464
464
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @license BSD-3-Clause (see LICENSE in the root directory of this source tree)
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import {DateTimeException} from '../errors';
|
|
7
|
+
import { DateTimeException } from '../errors';
|
|
8
8
|
|
|
9
9
|
export class ZoneRulesProvider {
|
|
10
10
|
/**
|
|
@@ -18,7 +18,7 @@ export class ZoneRulesProvider {
|
|
|
18
18
|
* @return {ZoneRules}
|
|
19
19
|
*/
|
|
20
20
|
static getRules(zoneId){
|
|
21
|
-
throw new DateTimeException(`unsupported ZoneId:${
|
|
21
|
+
throw new DateTimeException(`unsupported ZoneId:${zoneId}`);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
|
|
File without changes
|