@js-joda/core 6.1.0 → 6.3.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 +5136 -5019
- package/dist/js-joda.cjs.js.map +1 -1
- package/dist/js-joda.esm.js +5136 -5019
- package/dist/js-joda.esm.js.map +1 -1
- package/dist/js-joda.js +5136 -5019
- 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 +43 -4
- package/src/Instant.js +16 -2
- package/src/MonthDay.js +1 -1
- package/src/ZonedDateTime.js +1 -1
- package/src/format/DateTimeBuilder.js +148 -8
- package/src/format/DateTimeFormatter.js +6 -4
- package/src/temporal/TemporalField.js +1 -1
- package/src/zone/ZoneOffsetTransition.js +2 -2
- package/typings/js-joda.d.ts +15 -0
- package/typings/js-joda.flow.js +5 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@js-joda/core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.3.0",
|
|
4
4
|
"description": "a date and time library for javascript",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"sourceMap": false,
|
|
48
48
|
"instrument": false
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "8c0a3b1b555bc09fced243dac13fdf5ef9746dc7"
|
|
51
51
|
}
|
package/src/Duration.js
CHANGED
|
@@ -893,10 +893,18 @@ export class Duration extends TemporalAmount /*implements TemporalAmount, Compar
|
|
|
893
893
|
if (divisor === 1) {
|
|
894
894
|
return this;
|
|
895
895
|
}
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
896
|
+
// Give both components the same sign before truncating the quotient.
|
|
897
|
+
// Otherwise the positive nano adjustment of a negative duration is
|
|
898
|
+
// truncated separately and can move the result away from zero.
|
|
899
|
+
let seconds = this._seconds;
|
|
900
|
+
let nanos = this._nanos;
|
|
901
|
+
if (seconds < 0 && nanos > 0) {
|
|
902
|
+
seconds += 1;
|
|
903
|
+
nanos -= LocalTime.NANOS_PER_SECOND;
|
|
904
|
+
}
|
|
905
|
+
const secs = MathUtil.intDiv(seconds, divisor);
|
|
906
|
+
const remainder = MathUtil.intMod(seconds, divisor);
|
|
907
|
+
const nos = MathUtil.intDiv(remainder * LocalTime.NANOS_PER_SECOND + nanos, divisor);
|
|
900
908
|
return Duration.ofSeconds(secs, nos);
|
|
901
909
|
}
|
|
902
910
|
|
|
@@ -1081,6 +1089,21 @@ export class Duration extends TemporalAmount /*implements TemporalAmount, Compar
|
|
|
1081
1089
|
}
|
|
1082
1090
|
|
|
1083
1091
|
//-----------------------------------------------------------------------
|
|
1092
|
+
/**
|
|
1093
|
+
* Extracts the number of days in the duration.
|
|
1094
|
+
*
|
|
1095
|
+
* This returns the total number of days in the duration by dividing the
|
|
1096
|
+
* number of seconds by 86400.
|
|
1097
|
+
* This is based on the standard definition of a day as 24 hours.
|
|
1098
|
+
*
|
|
1099
|
+
* This instance is immutable and unaffected by this method call.
|
|
1100
|
+
*
|
|
1101
|
+
* @return {number} the number of days in the duration, may be negative
|
|
1102
|
+
*/
|
|
1103
|
+
toDaysPart() {
|
|
1104
|
+
return MathUtil.intDiv(this._seconds, LocalTime.SECONDS_PER_DAY);
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1084
1107
|
/**
|
|
1085
1108
|
* Extracts the number of hours part in the duration.
|
|
1086
1109
|
*
|
|
@@ -1143,6 +1166,22 @@ export class Duration extends TemporalAmount /*implements TemporalAmount, Compar
|
|
|
1143
1166
|
return MathUtil.intDiv(this._nanos, 1000000);
|
|
1144
1167
|
}
|
|
1145
1168
|
|
|
1169
|
+
/**
|
|
1170
|
+
* Get the nanoseconds part within seconds of the duration.
|
|
1171
|
+
*
|
|
1172
|
+
* The length of the duration is stored using two fields - seconds and nanoseconds.
|
|
1173
|
+
* The nanoseconds part is a value from 0 to 999,999,999 that is an adjustment to
|
|
1174
|
+
* the length in seconds.
|
|
1175
|
+
* The total duration is defined by calling {@link Duration.nano} and {@link Duration.seconds}.
|
|
1176
|
+
*
|
|
1177
|
+
* This instance is immutable and unaffected by this method call.
|
|
1178
|
+
*
|
|
1179
|
+
* @return {number} the nanoseconds within the second part of the length of the duration, from 0 to 999,999,999
|
|
1180
|
+
*/
|
|
1181
|
+
toNanosPart() {
|
|
1182
|
+
return this._nanos;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1146
1185
|
//-----------------------------------------------------------------------
|
|
1147
1186
|
/**
|
|
1148
1187
|
* Compares this duration to the specified {@link Duration}.
|
package/src/Instant.js
CHANGED
|
@@ -823,9 +823,17 @@ export class Instant extends Temporal {
|
|
|
823
823
|
* @private
|
|
824
824
|
*/
|
|
825
825
|
_microsUntil(end) {
|
|
826
|
-
|
|
826
|
+
let secsDiff = MathUtil.safeSubtract(end.epochSecond(), this.epochSecond());
|
|
827
|
+
let nanosDiff = end.nano() - this.nano();
|
|
828
|
+
if (secsDiff > 0 && nanosDiff < 0) {
|
|
829
|
+
secsDiff--;
|
|
830
|
+
nanosDiff += LocalTime.NANOS_PER_SECOND;
|
|
831
|
+
} else if (secsDiff < 0 && nanosDiff > 0) {
|
|
832
|
+
secsDiff++;
|
|
833
|
+
nanosDiff -= LocalTime.NANOS_PER_SECOND;
|
|
834
|
+
}
|
|
827
835
|
const totalMicros = MathUtil.safeMultiply(secsDiff, 1000000);
|
|
828
|
-
return MathUtil.safeAdd(totalMicros, MathUtil.intDiv(
|
|
836
|
+
return MathUtil.safeAdd(totalMicros, MathUtil.intDiv(nanosDiff, 1000));
|
|
829
837
|
}
|
|
830
838
|
|
|
831
839
|
/**
|
|
@@ -908,6 +916,12 @@ export class Instant extends Temporal {
|
|
|
908
916
|
* @throws ArithmeticException if numeric overflow occurs
|
|
909
917
|
*/
|
|
910
918
|
toEpochMilli() {
|
|
919
|
+
if (this._seconds < 0 && this._nanos > 0) {
|
|
920
|
+
// avoid an overflow of seconds * 1000 for instants close to the minimum epoch milli
|
|
921
|
+
const millis = MathUtil.safeMultiply(this._seconds + 1, 1000);
|
|
922
|
+
const adjustment = MathUtil.intDiv(this._nanos, NANOS_PER_MILLI) - 1000;
|
|
923
|
+
return MathUtil.safeAdd(millis, adjustment);
|
|
924
|
+
}
|
|
911
925
|
const millis = MathUtil.safeMultiply(this._seconds, 1000);
|
|
912
926
|
return millis + MathUtil.intDiv(this._nanos, NANOS_PER_MILLI);
|
|
913
927
|
}
|
package/src/MonthDay.js
CHANGED
|
@@ -25,7 +25,7 @@ import { ZoneId } from './ZoneId';
|
|
|
25
25
|
* A month-day in the ISO-8601 calendar system, such as `--12-03`.
|
|
26
26
|
*
|
|
27
27
|
* {@link MonthDay} is an immutable date-time object that represents the combination
|
|
28
|
-
* of a
|
|
28
|
+
* of a month and day. Any field that can be derived from a month and day, such as
|
|
29
29
|
* quarter-of-year, can be obtained.
|
|
30
30
|
*
|
|
31
31
|
* This class does not store or represent a year, time or time-zone.
|
package/src/ZonedDateTime.js
CHANGED
|
@@ -319,7 +319,7 @@ export class ZonedDateTime extends ChronoZonedDateTime {
|
|
|
319
319
|
*
|
|
320
320
|
* Converting an instant to a zoned date-time is simple as there is only one valid
|
|
321
321
|
* offset for each instant. If the valid offset is different to the offset specified,
|
|
322
|
-
* the
|
|
322
|
+
* the date-time and offset of the zoned date-time will differ from those specified.
|
|
323
323
|
*
|
|
324
324
|
* If the {@link ZoneId} to be used is a {@link ZoneOffset}, this method is equivalent
|
|
325
325
|
* to {@link of}.
|
|
@@ -14,13 +14,16 @@ import { ResolverStyle } from './ResolverStyle';
|
|
|
14
14
|
import { IsoChronology } from '../chrono/IsoChronology';
|
|
15
15
|
import { ChronoLocalDate } from '../chrono/ChronoLocalDate';
|
|
16
16
|
import { ChronoField } from '../temporal/ChronoField';
|
|
17
|
+
import { IsoFields } from '../temporal/IsoFields';
|
|
17
18
|
import { TemporalAccessor } from '../temporal/TemporalAccessor';
|
|
18
19
|
import { TemporalQueries } from '../temporal/TemporalQueries';
|
|
19
20
|
|
|
21
|
+
import { Instant } from '../Instant';
|
|
20
22
|
import { LocalTime } from '../LocalTime';
|
|
21
23
|
import { LocalDate } from '../LocalDate';
|
|
22
24
|
import { Period } from '../Period';
|
|
23
25
|
|
|
26
|
+
import { ZonedDateTime } from '../ZonedDateTime';
|
|
24
27
|
import { ZoneOffset } from '../ZoneOffset';
|
|
25
28
|
|
|
26
29
|
/**
|
|
@@ -145,25 +148,46 @@ export class DateTimeBuilder extends TemporalAccessor {
|
|
|
145
148
|
this.fieldValues.retainAll(resolverFields);
|
|
146
149
|
}
|
|
147
150
|
// handle standard fields
|
|
148
|
-
|
|
151
|
+
this._mergeInstantFields();
|
|
152
|
+
this._resolveFields(resolverStyle);
|
|
149
153
|
this._mergeDate(resolverStyle);
|
|
150
154
|
this._mergeTime(resolverStyle);
|
|
151
|
-
//if (resolveFields(resolverStyle)) {
|
|
152
|
-
// mergeInstantFields();
|
|
153
|
-
// mergeDate(resolverStyle);
|
|
154
|
-
// mergeTime(resolverStyle);
|
|
155
|
-
//}
|
|
156
155
|
this._resolveTimeInferZeroes(resolverStyle);
|
|
157
|
-
|
|
156
|
+
this._crossCheck();
|
|
158
157
|
if (this.excessDays != null && this.excessDays.isZero() === false && this.date != null && this.time != null) {
|
|
159
158
|
this.date = this.date.plus(this.excessDays);
|
|
160
159
|
this.excessDays = Period.ZERO;
|
|
161
160
|
}
|
|
162
|
-
|
|
161
|
+
this._resolveFractional();
|
|
163
162
|
this._resolveInstant();
|
|
164
163
|
return this;
|
|
165
164
|
}
|
|
166
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Resolves the date fields that are not {@link ChronoField}s by delegating to their own
|
|
168
|
+
* `resolve()`, the step java.time performs generically. As parsed values are held in a
|
|
169
|
+
* name-keyed map, the ISO fields that define a `resolve()` (week-of-week-based-year and
|
|
170
|
+
* day-of-quarter) are handled here. They do not depend on one another, so one pass is
|
|
171
|
+
* sufficient. Returns whether a date was produced.
|
|
172
|
+
*
|
|
173
|
+
* @param {ResolverStyle} resolverStyle
|
|
174
|
+
* @return {boolean}
|
|
175
|
+
* @private
|
|
176
|
+
*/
|
|
177
|
+
_resolveFields(resolverStyle) {
|
|
178
|
+
let resolved = false;
|
|
179
|
+
for (const field of [IsoFields.WEEK_OF_WEEK_BASED_YEAR, IsoFields.DAY_OF_QUARTER]) {
|
|
180
|
+
if (this.fieldValues.containsKey(field)) {
|
|
181
|
+
const date = field.resolve(this.fieldValues, this, resolverStyle);
|
|
182
|
+
if (date != null) {
|
|
183
|
+
this._checkDate(date);
|
|
184
|
+
resolved = true;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return resolved;
|
|
189
|
+
}
|
|
190
|
+
|
|
167
191
|
/**
|
|
168
192
|
*
|
|
169
193
|
* @param {ResolverStyle} resolverStyle
|
|
@@ -446,6 +470,122 @@ export class DateTimeBuilder extends TemporalAccessor {
|
|
|
446
470
|
}
|
|
447
471
|
}
|
|
448
472
|
|
|
473
|
+
/**
|
|
474
|
+
* Converts a parsed instant-seconds into a date and a second-of-day, using the parsed zone
|
|
475
|
+
* or, if there is none, the parsed offset. Without a zone or offset, the instant-seconds
|
|
476
|
+
* are left unchanged.
|
|
477
|
+
*
|
|
478
|
+
* @private
|
|
479
|
+
*/
|
|
480
|
+
_mergeInstantFields() {
|
|
481
|
+
if (this.fieldValues.containsKey(ChronoField.INSTANT_SECONDS)) {
|
|
482
|
+
if (this.zone != null) {
|
|
483
|
+
this._mergeInstantFields0(this.zone);
|
|
484
|
+
} else {
|
|
485
|
+
const offsetSecs = this.fieldValues.get(ChronoField.OFFSET_SECONDS);
|
|
486
|
+
if (offsetSecs != null) {
|
|
487
|
+
this._mergeInstantFields0(ZoneOffset.ofTotalSeconds(offsetSecs));
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* @param {ZoneId} selectedZone
|
|
495
|
+
* @private
|
|
496
|
+
*/
|
|
497
|
+
_mergeInstantFields0(selectedZone) {
|
|
498
|
+
const instant = Instant.ofEpochSecond(this.fieldValues.remove(ChronoField.INSTANT_SECONDS));
|
|
499
|
+
const zdt = ZonedDateTime.ofInstant(instant, selectedZone);
|
|
500
|
+
if (this.date == null) {
|
|
501
|
+
this._addObject(zdt.toLocalDate());
|
|
502
|
+
} else {
|
|
503
|
+
this._resolveMakeChanges(ChronoField.INSTANT_SECONDS, zdt.toLocalDate());
|
|
504
|
+
}
|
|
505
|
+
this._addFieldValue(ChronoField.SECOND_OF_DAY, zdt.toLocalTime().toSecondOfDay());
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
/**
|
|
509
|
+
* @param {TemporalField} targetField
|
|
510
|
+
* @param {LocalDate} date
|
|
511
|
+
* @private
|
|
512
|
+
*/
|
|
513
|
+
_resolveMakeChanges(targetField, date) {
|
|
514
|
+
const epochDay = date.toEpochDay();
|
|
515
|
+
const old = this.fieldValues.get(ChronoField.EPOCH_DAY);
|
|
516
|
+
this.fieldValues.put(ChronoField.EPOCH_DAY, epochDay);
|
|
517
|
+
if (old != null && old !== epochDay) {
|
|
518
|
+
throw new DateTimeException(`Conflict found: ${LocalDate.ofEpochDay(old)} differs from ${LocalDate.ofEpochDay(epochDay)} while resolving ${targetField}`);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Checks the remaining field values against the resolved date and time, and removes the
|
|
524
|
+
* ones that match.
|
|
525
|
+
*
|
|
526
|
+
* @private
|
|
527
|
+
*/
|
|
528
|
+
_crossCheck() {
|
|
529
|
+
if (this.date != null && this.time != null) {
|
|
530
|
+
this._crossCheck0(this.date.atTime(this.time));
|
|
531
|
+
} else if (this.date != null) {
|
|
532
|
+
this._crossCheck0(this.date);
|
|
533
|
+
} else if (this.time != null) {
|
|
534
|
+
this._crossCheck0(this.time);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* @param {TemporalAccessor} temporal
|
|
540
|
+
* @private
|
|
541
|
+
*/
|
|
542
|
+
_crossCheck0(temporal) {
|
|
543
|
+
for (const fieldName in this.fieldValues.keySet()) {
|
|
544
|
+
const field = ChronoField.byName(fieldName);
|
|
545
|
+
if (field && this.fieldValues.get(field) !== undefined) { // undefined if "removed" in EnumMap
|
|
546
|
+
if (temporal.isSupported(field)) {
|
|
547
|
+
let temporalValue;
|
|
548
|
+
try {
|
|
549
|
+
temporalValue = temporal.getLong(field);
|
|
550
|
+
} catch (ex) {
|
|
551
|
+
if (ex instanceof DateTimeException) {
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
throw ex;
|
|
555
|
+
}
|
|
556
|
+
const value = this.fieldValues.get(field);
|
|
557
|
+
if (temporalValue !== value) {
|
|
558
|
+
throw new DateTimeException(`Cross check failed: ${field} ${temporalValue} vs ${field} ${value}`);
|
|
559
|
+
}
|
|
560
|
+
this.fieldValues.remove(field);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Without a time, adds the fraction-of-second fields to a parsed instant-seconds,
|
|
568
|
+
* second-of-day or second-of-minute, with zero if no nano-of-second was parsed.
|
|
569
|
+
*
|
|
570
|
+
* @private
|
|
571
|
+
*/
|
|
572
|
+
_resolveFractional() {
|
|
573
|
+
if (this.time == null &&
|
|
574
|
+
(this.fieldValues.containsKey(ChronoField.INSTANT_SECONDS) ||
|
|
575
|
+
this.fieldValues.containsKey(ChronoField.SECOND_OF_DAY) ||
|
|
576
|
+
this.fieldValues.containsKey(ChronoField.SECOND_OF_MINUTE))) {
|
|
577
|
+
if (this.fieldValues.containsKey(ChronoField.NANO_OF_SECOND)) {
|
|
578
|
+
const nos = this.fieldValues.get(ChronoField.NANO_OF_SECOND);
|
|
579
|
+
this.fieldValues.put(ChronoField.MICRO_OF_SECOND, MathUtil.intDiv(nos, 1000));
|
|
580
|
+
this.fieldValues.put(ChronoField.MILLI_OF_SECOND, MathUtil.intDiv(nos, 1000000));
|
|
581
|
+
} else {
|
|
582
|
+
this.fieldValues.put(ChronoField.NANO_OF_SECOND, 0);
|
|
583
|
+
this.fieldValues.put(ChronoField.MICRO_OF_SECOND, 0);
|
|
584
|
+
this.fieldValues.put(ChronoField.MILLI_OF_SECOND, 0);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
449
589
|
_resolveInstant() {
|
|
450
590
|
if (this.date != null && this.time != null) {
|
|
451
591
|
const offsetSecs = this.fieldValues.get(ChronoField.OFFSET_SECONDS);
|
|
@@ -21,6 +21,7 @@ import { ResolverStyle } from './ResolverStyle';
|
|
|
21
21
|
|
|
22
22
|
import { IsoChronology } from '../chrono/IsoChronology';
|
|
23
23
|
import { ChronoField } from '../temporal/ChronoField';
|
|
24
|
+
import { IsoFields } from '../temporal/IsoFields';
|
|
24
25
|
import { createTemporalQuery } from '../temporal/TemporalQuery';
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -696,12 +697,13 @@ export function _init() {
|
|
|
696
697
|
.toFormatter(ResolverStyle.STRICT);
|
|
697
698
|
|
|
698
699
|
DateTimeFormatter.ISO_WEEK_DATE = new DateTimeFormatterBuilder()
|
|
699
|
-
.
|
|
700
|
+
.parseCaseInsensitive()
|
|
701
|
+
.appendValue(IsoFields.WEEK_BASED_YEAR, 4, 10, SignStyle.EXCEEDS_PAD)
|
|
700
702
|
.appendLiteral('-W')
|
|
701
|
-
.appendValue(
|
|
703
|
+
.appendValue(IsoFields.WEEK_OF_WEEK_BASED_YEAR, 2)
|
|
702
704
|
.appendLiteral('-')
|
|
703
|
-
.appendValue(ChronoField.DAY_OF_WEEK)
|
|
704
|
-
.toFormatter(ResolverStyle.STRICT);
|
|
705
|
+
.appendValue(ChronoField.DAY_OF_WEEK, 1)
|
|
706
|
+
.toFormatter(ResolverStyle.STRICT).withChronology(IsoChronology.INSTANCE);
|
|
705
707
|
|
|
706
708
|
DateTimeFormatter.ISO_DATE = new DateTimeFormatterBuilder()
|
|
707
709
|
.parseCaseInsensitive()
|
|
@@ -199,7 +199,7 @@ export class TemporalField {
|
|
|
199
199
|
* Checks if this field is supported by the temporal object.
|
|
200
200
|
*
|
|
201
201
|
* This determines whether the temporal accessor supports this field.
|
|
202
|
-
* If this returns false, the
|
|
202
|
+
* If this returns false, the temporal cannot be queried for this field.
|
|
203
203
|
*
|
|
204
204
|
* There are two equivalent ways of using this method.
|
|
205
205
|
* The first is to invoke this method directly.
|
|
@@ -17,7 +17,7 @@ import { LocalDateTime } from '../LocalDateTime';
|
|
|
17
17
|
* The discontinuity is normally a gap in spring and an overlap in autumn.
|
|
18
18
|
* {@link ZoneOffsetTransition} models the transition between the two offsets.
|
|
19
19
|
*
|
|
20
|
-
* Gaps occur where there are local date-times that simply do not
|
|
20
|
+
* Gaps occur where there are local date-times that simply do not exist.
|
|
21
21
|
* An example would be when the offset changes from `+03:00` to `+04:00`.
|
|
22
22
|
* This might be described as 'the clocks will move forward one hour tonight at 1am'.
|
|
23
23
|
*
|
|
@@ -178,7 +178,7 @@ export class ZoneOffsetTransition {
|
|
|
178
178
|
/**
|
|
179
179
|
* Does this transition represent a gap in the local time-line.
|
|
180
180
|
*
|
|
181
|
-
* Gaps occur where there are local date-times that simply do not
|
|
181
|
+
* Gaps occur where there are local date-times that simply do not exist.
|
|
182
182
|
* An example would be when the offset changes from `+01:00` to `+02:00`.
|
|
183
183
|
* This might be described as 'the clocks will move forward one hour tonight at 1am'.
|
|
184
184
|
*
|
package/typings/js-joda.d.ts
CHANGED
|
@@ -1110,6 +1110,7 @@ export class Duration extends TemporalAmount {
|
|
|
1110
1110
|
minus(amount: number, unit: TemporalUnit): Duration;
|
|
1111
1111
|
minus(duration: Duration): Duration;
|
|
1112
1112
|
minusDays(daysToSubtract: number): Duration;
|
|
1113
|
+
minusDuration(duration: Duration): Duration;
|
|
1113
1114
|
minusHours(hoursToSubtract: number): Duration;
|
|
1114
1115
|
minusMillis(millisToSubtract: number): Duration;
|
|
1115
1116
|
minusMinutes(minutesToSubtract: number): Duration;
|
|
@@ -1136,10 +1137,12 @@ export class Duration extends TemporalAmount {
|
|
|
1136
1137
|
toMillis(): number;
|
|
1137
1138
|
toMinutes(): number;
|
|
1138
1139
|
toNanos(): number;
|
|
1140
|
+
toDaysPart(): number;
|
|
1139
1141
|
toHoursPart(): number;
|
|
1140
1142
|
toMinutesPart(): number;
|
|
1141
1143
|
toSecondsPart(): number;
|
|
1142
1144
|
toMillisPart(): number;
|
|
1145
|
+
toNanosPart(): number;
|
|
1143
1146
|
toString(): string;
|
|
1144
1147
|
units(): TemporalUnit[];
|
|
1145
1148
|
withNanos(nanoOfSecond: number): Duration;
|
|
@@ -1534,6 +1537,7 @@ export class Year extends Temporal implements TemporalAdjuster {
|
|
|
1534
1537
|
atMonthDay(monthDay: MonthDay): LocalDate;
|
|
1535
1538
|
compareTo(other: Year): number;
|
|
1536
1539
|
equals(other: any): boolean;
|
|
1540
|
+
format(formatter: DateTimeFormatter): string;
|
|
1537
1541
|
getLong(field: TemporalField): number;
|
|
1538
1542
|
isAfter(other: Year): boolean;
|
|
1539
1543
|
isBefore(other: Year): boolean;
|
|
@@ -1700,6 +1704,7 @@ export class OffsetDateTime extends Temporal implements TemporalAdjuster {
|
|
|
1700
1704
|
toLocalTime(): LocalTime;
|
|
1701
1705
|
toOffsetTime(): OffsetTime;
|
|
1702
1706
|
toString(): string;
|
|
1707
|
+
toZonedDateTime(): ZonedDateTime;
|
|
1703
1708
|
truncatedTo(unit: TemporalUnit): OffsetDateTime;
|
|
1704
1709
|
until(endExclusive: Temporal, unit: TemporalUnit): number;
|
|
1705
1710
|
with(adjuster: TemporalAdjuster): OffsetDateTime;
|
|
@@ -2069,6 +2074,7 @@ export class ZoneOffset extends ZoneId implements TemporalAdjuster {
|
|
|
2069
2074
|
getLong(field: TemporalField): number;
|
|
2070
2075
|
hashCode(): number;
|
|
2071
2076
|
id(): string;
|
|
2077
|
+
query<R>(query: TemporalQuery<R>): R | null;
|
|
2072
2078
|
rules(): ZoneRules;
|
|
2073
2079
|
toString(): string;
|
|
2074
2080
|
totalSeconds(): number;
|
|
@@ -2219,6 +2225,8 @@ export class DateTimeFormatterBuilder {
|
|
|
2219
2225
|
}
|
|
2220
2226
|
|
|
2221
2227
|
export class DecimalStyle {
|
|
2228
|
+
static STANDARD: DecimalStyle;
|
|
2229
|
+
|
|
2222
2230
|
private constructor();
|
|
2223
2231
|
|
|
2224
2232
|
decimalSeparator(): string;
|
|
@@ -2227,6 +2235,10 @@ export class DecimalStyle {
|
|
|
2227
2235
|
negativeSign(): string;
|
|
2228
2236
|
positiveSign(): string;
|
|
2229
2237
|
toString(): string;
|
|
2238
|
+
withDecimalSeparator(decimalSeparator: string): DecimalStyle;
|
|
2239
|
+
withNegativeSign(negativeSign: string): DecimalStyle;
|
|
2240
|
+
withPositiveSign(positiveSign: string): DecimalStyle;
|
|
2241
|
+
withZeroDigit(zeroDigit: string): DecimalStyle;
|
|
2230
2242
|
zeroDigit(): string;
|
|
2231
2243
|
}
|
|
2232
2244
|
|
|
@@ -2456,10 +2468,13 @@ export class ZoneRulesProvider {
|
|
|
2456
2468
|
export type Chronology = IsoChronology;
|
|
2457
2469
|
|
|
2458
2470
|
export abstract class IsoChronology {
|
|
2471
|
+
static INSTANCE: IsoChronology;
|
|
2472
|
+
|
|
2459
2473
|
static isLeapYear(prolepticYear: number): boolean;
|
|
2460
2474
|
|
|
2461
2475
|
private constructor();
|
|
2462
2476
|
|
|
2477
|
+
date(temporal: TemporalAccessor): LocalDate;
|
|
2463
2478
|
equals(other: any): boolean;
|
|
2464
2479
|
resolveDate(fieldValues: any, resolverStyle: any): any;
|
|
2465
2480
|
toString(): string;
|
package/typings/js-joda.flow.js
CHANGED
|
@@ -108,10 +108,12 @@ declare module "js-joda" {
|
|
|
108
108
|
toMillis(): number;
|
|
109
109
|
toMinutes(): number;
|
|
110
110
|
toNanos(): number;
|
|
111
|
+
toDaysPart(): number;
|
|
111
112
|
toHoursPart(): number;
|
|
112
113
|
toMinutesPart(): number;
|
|
113
114
|
toSecondsPart(): number;
|
|
114
115
|
toMillisPart(): number;
|
|
116
|
+
toNanosPart(): number;
|
|
115
117
|
toString(): string;
|
|
116
118
|
units(): any;
|
|
117
119
|
withNanos(nanoOfSecond: number): Duration;
|
|
@@ -737,6 +739,7 @@ declare module "js-joda" {
|
|
|
737
739
|
now(zoneIdOrClock?: ZoneId | Clock): Year; of(isoYear: number): Year;
|
|
738
740
|
parse(text: string, formatter?: DateTimeFormatter): Year;
|
|
739
741
|
atMonth(monthOrNumber: Month | number): Year;
|
|
742
|
+
format(formatter: DateTimeFormatter): string;
|
|
740
743
|
plus(amountOrNumber: TemporalAmount | number, unit?: TemporalUnit): Year;
|
|
741
744
|
minus(amountOrNumber: TemporalAmount | number, unit?: TemporalUnit): Year
|
|
742
745
|
}
|
|
@@ -938,7 +941,9 @@ declare module "js-joda" {
|
|
|
938
941
|
}
|
|
939
942
|
|
|
940
943
|
declare class IsoChronology {
|
|
944
|
+
INSTANCE: IsoChronology;
|
|
941
945
|
isLeapYear(prolepticYear: number): boolean;
|
|
946
|
+
date(temporal: TemporalAccessor): LocalDate;
|
|
942
947
|
resolveDate(fieldValues: any, resolverStyle: any): any;
|
|
943
948
|
equals(other: any): boolean;
|
|
944
949
|
toString(): string
|