@js-joda/extra 0.9.1 → 0.10.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/README.md +3 -3
- package/dist/js-joda-extra.esm.js +1991 -22
- package/dist/js-joda-extra.esm.js.map +1 -1
- package/dist/js-joda-extra.js +1994 -20
- package/dist/js-joda-extra.js.map +1 -1
- package/dist/js-joda-extra.min.js +2 -2
- package/package.json +3 -4
- package/src/DayOfMonth.js +54 -54
- package/src/DayOfYear.js +48 -49
- package/src/Interval.js +93 -99
- package/src/LocalDateRange.js +750 -0
- package/src/OffsetDate.js +1279 -0
- package/src/Quarter.js +587 -0
- package/src/YearQuarter.js +1177 -0
- package/src/YearWeek.js +1026 -0
- package/src/_init.js +10 -0
- package/src/assert.js +2 -2
- package/src/js-joda-extra.js +10 -0
- package/src/plug.js +10 -0
- package/typings/js-joda-extra.d.ts +234 -2
package/src/_init.js
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
import { _init as dayOfMonthInit } from './DayOfMonth';
|
|
7
7
|
import { _init as dayOfYearInit } from './DayOfYear';
|
|
8
8
|
import { _init as intervalInit } from './Interval';
|
|
9
|
+
import { _init as localDateRangeInit } from './LocalDateRange';
|
|
10
|
+
import { _init as offsetDateInit } from './OffsetDate';
|
|
11
|
+
import { _init as quarterInit } from './Quarter';
|
|
12
|
+
import { _init as yearQuarterInit } from './YearQuarter';
|
|
13
|
+
import { _init as yearWeekInit } from './YearWeek';
|
|
9
14
|
|
|
10
15
|
let isInit = false;
|
|
11
16
|
|
|
@@ -19,6 +24,11 @@ function init() {
|
|
|
19
24
|
dayOfMonthInit();
|
|
20
25
|
dayOfYearInit();
|
|
21
26
|
intervalInit();
|
|
27
|
+
localDateRangeInit();
|
|
28
|
+
offsetDateInit();
|
|
29
|
+
quarterInit();
|
|
30
|
+
yearQuarterInit();
|
|
31
|
+
yearWeekInit();
|
|
22
32
|
}
|
|
23
33
|
|
|
24
34
|
init();
|
package/src/assert.js
CHANGED
|
@@ -27,7 +27,7 @@ export function assert(assertion, msg, error) {
|
|
|
27
27
|
*
|
|
28
28
|
* @param value
|
|
29
29
|
* @param parameterName
|
|
30
|
-
* @
|
|
30
|
+
* @return {*}
|
|
31
31
|
*/
|
|
32
32
|
export function requireNonNull(value, parameterName) {
|
|
33
33
|
if (value == null) {
|
|
@@ -42,7 +42,7 @@ export function requireNonNull(value, parameterName) {
|
|
|
42
42
|
* @param value
|
|
43
43
|
* @param _class
|
|
44
44
|
* @param parameterName
|
|
45
|
-
* @
|
|
45
|
+
* @return {_class}
|
|
46
46
|
*/
|
|
47
47
|
export function requireInstance(value, _class, parameterName) {
|
|
48
48
|
if (!(value instanceof _class)) {
|
package/src/js-joda-extra.js
CHANGED
|
@@ -8,6 +8,11 @@ import { use } from '@js-joda/core';
|
|
|
8
8
|
import { DayOfMonth } from './DayOfMonth';
|
|
9
9
|
import { DayOfYear } from './DayOfYear';
|
|
10
10
|
import { Interval } from './Interval';
|
|
11
|
+
import { LocalDateRange } from './LocalDateRange';
|
|
12
|
+
import { OffsetDate } from './OffsetDate';
|
|
13
|
+
import { Quarter } from './Quarter';
|
|
14
|
+
import { YearQuarter } from './YearQuarter';
|
|
15
|
+
import { YearWeek } from './YearWeek';
|
|
11
16
|
import plug from './plug';
|
|
12
17
|
|
|
13
18
|
use(plug);
|
|
@@ -16,4 +21,9 @@ export {
|
|
|
16
21
|
DayOfMonth,
|
|
17
22
|
DayOfYear,
|
|
18
23
|
Interval,
|
|
24
|
+
LocalDateRange,
|
|
25
|
+
OffsetDate,
|
|
26
|
+
Quarter,
|
|
27
|
+
YearQuarter,
|
|
28
|
+
YearWeek,
|
|
19
29
|
};
|
package/src/plug.js
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
// import { DayOfMonth } from './DayOfMonth';
|
|
7
7
|
// import { DayOfYear } from './DayOfYear';
|
|
8
8
|
// import { Interval } from './Interval';
|
|
9
|
+
// import { LocalDateRange } from './LocalDateRange';
|
|
10
|
+
// import { OffsetDate } from './OffsetDate';
|
|
11
|
+
// import { Quarter } from './Quarter';
|
|
12
|
+
// import { YearQuarter } from './YearQuarter';
|
|
13
|
+
// import { YearWeek } from './YearWeek';
|
|
9
14
|
|
|
10
15
|
import './_init';
|
|
11
16
|
|
|
@@ -19,4 +24,9 @@ export default function (/* jsJoda */) {
|
|
|
19
24
|
// jsJoda.DayOfMonth = DayOfMonth;
|
|
20
25
|
// jsJoda.DayOfYear = DayOfYear;
|
|
21
26
|
// jsJoda.Interval = Interval;
|
|
27
|
+
// jsJoda.LocalDateRange = LocalDateRange;
|
|
28
|
+
// jsJoda.OffsetDate = OffsetDate;
|
|
29
|
+
// jsJoda.Quarter = Quarter;
|
|
30
|
+
// jsJoda.YearQuarter = YearQuarter;
|
|
31
|
+
// jsJoda.YearWeek = YearWeek;
|
|
22
32
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Instant, Duration, TemporalAccessor, Clock, ZoneId, TemporalField, ValueRange, TemporalQuery, Temporal, LocalDate, Year, MonthDay, YearMonth, Month } from '@js-joda/core';
|
|
1
|
+
import { Instant, Duration, TemporalAccessor, Clock, ZoneId, TemporalField, ValueRange, TemporalQuery, Temporal, LocalDate, Year, MonthDay, YearMonth, Month, DateTimeFormatter, DayOfWeek, TemporalUnit, TemporalAmount, TemporalAdjuster, ZoneOffset, OffsetDateTime, LocalTime, Period } from '@js-joda/core';
|
|
2
2
|
|
|
3
3
|
export class DayOfMonth extends TemporalAccessor {
|
|
4
4
|
static from(temporal: TemporalAccessor): DayOfMonth;
|
|
@@ -50,7 +50,7 @@ export class Interval {
|
|
|
50
50
|
static of(startInclusive: Instant, duration: Duration): Interval;
|
|
51
51
|
static parse(text: string): Interval;
|
|
52
52
|
|
|
53
|
-
private constructor();
|
|
53
|
+
private constructor(startInclusive: Instant, endExclusive: Instant);
|
|
54
54
|
|
|
55
55
|
start(): Instant;
|
|
56
56
|
end(): Instant;
|
|
@@ -79,5 +79,237 @@ export class Interval {
|
|
|
79
79
|
toString(): string;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
export class LocalDateRange {
|
|
83
|
+
static of(startInclusive: LocalDate, endExclusive: LocalDate): LocalDateRange;
|
|
84
|
+
static of(startInclusive: LocalDate, period: Period): LocalDateRange;
|
|
85
|
+
static ofClosed(startInclusive: LocalDate, endInclusive: LocalDate): LocalDateRange;
|
|
86
|
+
static ofEmpty(date: LocalDate): LocalDateRange;
|
|
87
|
+
static ofUnbounded(): LocalDateRange;
|
|
88
|
+
static ofUnboundedEnd(startInclusive: LocalDate): LocalDateRange;
|
|
89
|
+
static ofUnboundedStart(endExclusive: LocalDate): LocalDateRange;
|
|
90
|
+
static parse(text: string): LocalDateRange;
|
|
91
|
+
|
|
92
|
+
private constructor(startInclusive: LocalDate, endExclusive: LocalDate);
|
|
93
|
+
|
|
94
|
+
abuts(other: LocalDateRange): boolean;
|
|
95
|
+
contains(date: LocalDate): boolean;
|
|
96
|
+
encloses(other: LocalDateRange): boolean;
|
|
97
|
+
equals(obj: any): boolean;
|
|
98
|
+
end(): LocalDate;
|
|
99
|
+
endInclusive(): LocalDate;
|
|
100
|
+
start(): LocalDate;
|
|
101
|
+
hashCode(): number;
|
|
102
|
+
intersection(other: LocalDateRange): LocalDateRange;
|
|
103
|
+
isAfter(rangeOrDate: LocalDate | LocalDateRange): boolean;
|
|
104
|
+
isBefore(rangeOrDate: LocalDate | LocalDateRange): boolean;
|
|
105
|
+
isConnected(other: LocalDateRange): boolean;
|
|
106
|
+
isEmpty(): boolean;
|
|
107
|
+
isUnboundedEnd(): boolean;
|
|
108
|
+
isUnboundedStart(): boolean;
|
|
109
|
+
lengthInDays(): number;
|
|
110
|
+
overlaps(other: LocalDateRange): boolean;
|
|
111
|
+
span(other: LocalDateRange): LocalDateRange;
|
|
112
|
+
toPeriod(): Period;
|
|
113
|
+
toString(): string;
|
|
114
|
+
union(other: LocalDateRange): LocalDateRange;
|
|
115
|
+
withEnd(adjuster: TemporalAdjuster): LocalDateRange;
|
|
116
|
+
withStart(adjuster: TemporalAdjuster): LocalDateRange;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export class OffsetDate extends Temporal implements TemporalAdjuster {
|
|
120
|
+
static from(temporal: TemporalAccessor): OffsetDate;
|
|
121
|
+
static now(zoneIdOrClock?: ZoneId | Clock): OffsetDate;
|
|
122
|
+
static of(year: number, month: number, dayOfMonth: number, offset: ZoneOffset): OffsetDate;
|
|
123
|
+
static of(date: LocalDate, offset: ZoneOffset): OffsetDate;
|
|
124
|
+
static ofInstant(instant: Instant, zone: ZoneId): OffsetDate;
|
|
125
|
+
static parse(text: string, formatter?: DateTimeFormatter): OffsetDate;
|
|
126
|
+
|
|
127
|
+
private constructor(date: LocalDate, offset: ZoneOffset);
|
|
128
|
+
|
|
129
|
+
adjustInto(temporal: Temporal): Temporal;
|
|
130
|
+
atTime(time: LocalTime): OffsetDateTime;
|
|
131
|
+
compareTo(other: OffsetDate): number;
|
|
132
|
+
equals(object: any): boolean
|
|
133
|
+
format(formatter: DateTimeFormatter): string;
|
|
134
|
+
get(field: TemporalField): number;
|
|
135
|
+
dayOfMonth(): number;
|
|
136
|
+
dayOfWeek(): number;
|
|
137
|
+
dayOfYear(): number;
|
|
138
|
+
getLong(field: TemporalField): number;
|
|
139
|
+
month(): Month;
|
|
140
|
+
monthValue(): number;
|
|
141
|
+
offset(): ZoneOffset;
|
|
142
|
+
year(): number;
|
|
143
|
+
hashCode(): number;
|
|
144
|
+
isAfter(other: OffsetDate): boolean;
|
|
145
|
+
isBefore(other: OffsetDate): boolean;
|
|
146
|
+
isEqual(other: OffsetDate): boolean;
|
|
147
|
+
isSupported(fieldOrUnit: TemporalField | TemporalUnit): boolean;
|
|
148
|
+
minus(amountToSubtract: number, unit: TemporalUnit): OffsetDate;
|
|
149
|
+
minus(amountToSubtract: TemporalAmount): OffsetDate;
|
|
150
|
+
minusDays(days: number): OffsetDate;
|
|
151
|
+
minusMonths(months: number): OffsetDate;
|
|
152
|
+
minusWeeks(weeks: number): OffsetDate;
|
|
153
|
+
minusYears(years: number): OffsetDate;
|
|
154
|
+
plus(amountToAdd: number, unit: TemporalUnit): OffsetDate;
|
|
155
|
+
plus(amountToAdd: TemporalAmount): OffsetDate;
|
|
156
|
+
plusDays(days: number): OffsetDate;
|
|
157
|
+
plusMonths(months: number): OffsetDate;
|
|
158
|
+
plusWeeks(weeks: number): OffsetDate;
|
|
159
|
+
plusYears(years: number): OffsetDate;
|
|
160
|
+
query<R>(query: TemporalQuery<R>): R | null;
|
|
161
|
+
range(field: TemporalField): ValueRange;
|
|
162
|
+
toEpochSecond(time: LocalTime): number;
|
|
163
|
+
toLocalDate(): LocalDate;
|
|
164
|
+
toString(): string;
|
|
165
|
+
until(endExclusive: Temporal, unit: TemporalUnit): number;
|
|
166
|
+
with(adjuster: TemporalAdjuster): OffsetDate;
|
|
167
|
+
with(field: TemporalField, newValue: number): OffsetDate;
|
|
168
|
+
withDayOfMonth(dayOfMonth: number): OffsetDate;
|
|
169
|
+
withDayOfYear(dayOfYear: number): OffsetDate;
|
|
170
|
+
withMonth(month: number): OffsetDate;
|
|
171
|
+
withOffsetSameLocal(offset: ZoneOffset): OffsetDate;
|
|
172
|
+
withYear(year: number): OffsetDate;
|
|
173
|
+
|
|
174
|
+
protected _minusUnit(amountToSubtract: number, unit: TemporalUnit): OffsetDate;
|
|
175
|
+
protected _minusAmount(amount: TemporalAmount): OffsetDate;
|
|
176
|
+
protected _plusUnit(amountToAdd: number, unit: TemporalUnit): OffsetDate;
|
|
177
|
+
protected _plusAmount(amount: TemporalAmount): OffsetDate;
|
|
178
|
+
protected _withAdjuster(adjuster: TemporalAdjuster): OffsetDate;
|
|
179
|
+
protected _withField(field: TemporalField, newValue: number): OffsetDate;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export class Quarter extends TemporalAccessor implements TemporalAdjuster {
|
|
183
|
+
static Q1: Quarter;
|
|
184
|
+
static Q2: Quarter;
|
|
185
|
+
static Q3: Quarter;
|
|
186
|
+
static Q4: Quarter;
|
|
187
|
+
|
|
188
|
+
static from(temporal: TemporalAccessor): Quarter;
|
|
189
|
+
static of(quarterOfYear: number): Quarter;
|
|
190
|
+
static ofMonth(monthOfYear: number): Quarter;
|
|
191
|
+
static valueOf(name: string): Quarter;
|
|
192
|
+
static values(): Quarter[];
|
|
193
|
+
|
|
194
|
+
private constructor(value: number, name: string);
|
|
195
|
+
|
|
196
|
+
adjustInto(temporal: Temporal): Temporal;
|
|
197
|
+
compareTo(other: Quarter): number;
|
|
198
|
+
equals(other: any): boolean;
|
|
199
|
+
firstMonth(): Month;
|
|
200
|
+
get(field: TemporalField): number;
|
|
201
|
+
getLong(field: TemporalField): number;
|
|
202
|
+
isSupported(field: TemporalField): boolean;
|
|
203
|
+
length(leapYear: boolean): number;
|
|
204
|
+
minus(months: number): Quarter;
|
|
205
|
+
name(): string;
|
|
206
|
+
ordinal(): number;
|
|
207
|
+
plus(months: number): Quarter;
|
|
208
|
+
query<R>(query: TemporalQuery<R>): R | null;
|
|
209
|
+
range(field: TemporalField): ValueRange;
|
|
210
|
+
toString(): string;
|
|
211
|
+
value(): number;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export class YearQuarter extends Temporal {
|
|
215
|
+
static from(temporal: TemporalAccessor): YearQuarter;
|
|
216
|
+
static now(zoneIdOrClock?: ZoneId | Clock): YearQuarter;
|
|
217
|
+
static of(year: Year | number, quarter: Quarter | number): YearQuarter;
|
|
218
|
+
static parse(text: string, formatter?: DateTimeFormatter): YearQuarter;
|
|
219
|
+
|
|
220
|
+
private constructor(year: number, quarter: Quarter);
|
|
221
|
+
|
|
222
|
+
isSupported(fieldOrUnit: TemporalField | TemporalUnit): boolean
|
|
223
|
+
range(field: TemporalField): ValueRange;
|
|
224
|
+
get(field: TemporalField): number;
|
|
225
|
+
getLong(field: TemporalField): number;
|
|
226
|
+
year(): number;
|
|
227
|
+
quarterValue(): number;
|
|
228
|
+
quarter(): Quarter;
|
|
229
|
+
isLeapYear(): boolean;
|
|
230
|
+
isValidDay(dayOfQuarter: number): boolean;
|
|
231
|
+
lengthOfQuarter(): number;
|
|
232
|
+
lengthOfYear(): number;
|
|
233
|
+
with(adjuster: TemporalAdjuster): YearQuarter;
|
|
234
|
+
with(field: TemporalField, newValue: number): YearQuarter;
|
|
235
|
+
withYear(year: number): YearQuarter;
|
|
236
|
+
withQuarter(quarter: number): YearQuarter;
|
|
237
|
+
plus(amountToAdd: number, unit: TemporalUnit): YearQuarter;
|
|
238
|
+
plus(amountToAdd: TemporalAmount): YearQuarter;
|
|
239
|
+
plusYears(yearsToAdd: number): YearQuarter
|
|
240
|
+
plusQuarters(quartersToAdd: number): YearQuarter
|
|
241
|
+
minus(amountToSubtract: number, unit: TemporalUnit): YearQuarter;
|
|
242
|
+
minus(amountToSubtract: TemporalAmount): YearQuarter;
|
|
243
|
+
minusYears(yearsToSubtract: number): YearQuarter
|
|
244
|
+
minusQuarters(quartersToSubtract: number): YearQuarter
|
|
245
|
+
query<R>(query: TemporalQuery<R>): R | null;
|
|
246
|
+
adjustInto(temporal: Temporal): Temporal;
|
|
247
|
+
until(endExclusive: Temporal, unit: TemporalUnit): number;
|
|
248
|
+
format(formatter: DateTimeFormatter): string;
|
|
249
|
+
atDay(dayOfQuarter: number): LocalDate
|
|
250
|
+
atEndOfQuarter(): YearQuarter;
|
|
251
|
+
compareTo(other: YearQuarter): number;
|
|
252
|
+
isAfter(other: YearQuarter): boolean
|
|
253
|
+
isBefore(other: YearQuarter): boolean
|
|
254
|
+
equals(obj: any): boolean;
|
|
255
|
+
hashCode(): number;
|
|
256
|
+
toString(): string;
|
|
257
|
+
|
|
258
|
+
protected _minusUnit(amountToSubtract: number, unit: TemporalUnit): YearQuarter;
|
|
259
|
+
protected _minusAmount(amount: TemporalAmount): YearQuarter;
|
|
260
|
+
protected _plusUnit(amountToAdd: number, unit: TemporalUnit): YearQuarter;
|
|
261
|
+
protected _plusAmount(amount: TemporalAmount): YearQuarter;
|
|
262
|
+
protected _withAdjuster(adjuster: TemporalAdjuster): YearQuarter;
|
|
263
|
+
protected _withField(field: TemporalField, newValue: number): YearQuarter;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export class YearWeek extends Temporal {
|
|
267
|
+
static from(temporal: TemporalAccessor): YearWeek;
|
|
268
|
+
static now(zoneIdOrClock?: ZoneId | Clock): YearWeek;
|
|
269
|
+
static of(year: Year | number, week: number): YearWeek;
|
|
270
|
+
static parse(text: string, formatter?: DateTimeFormatter): YearWeek;
|
|
271
|
+
|
|
272
|
+
private constructor(weekBasedYear: number, week: number);
|
|
273
|
+
|
|
274
|
+
adjustInto(temporal: Temporal): Temporal;
|
|
275
|
+
atDay(dayOfWeek: DayOfWeek): LocalDate;
|
|
276
|
+
compareTo(other: YearWeek): number;
|
|
277
|
+
equals(obj: any): boolean;
|
|
278
|
+
format(formatter: DateTimeFormatter): string;
|
|
279
|
+
get(field: TemporalField): number;
|
|
280
|
+
getLong(field: TemporalField): number;
|
|
281
|
+
week(): number;
|
|
282
|
+
year(): number;
|
|
283
|
+
hashCode(): number;
|
|
284
|
+
is53WeekYear(): boolean
|
|
285
|
+
isAfter(other: YearWeek): boolean
|
|
286
|
+
isBefore(other: YearWeek): boolean
|
|
287
|
+
isSupported(fieldOrUnit: TemporalField | TemporalUnit): boolean;
|
|
288
|
+
lengthOfYear(): number;
|
|
289
|
+
minus(amountToSubtract: number, unit: TemporalUnit): YearWeek;
|
|
290
|
+
minus(amountToSubtract: TemporalAmount): YearWeek;
|
|
291
|
+
minusWeeks(weeksToSubtract: number): YearWeek;
|
|
292
|
+
minusYears(yearsToSubtract: number): YearWeek;
|
|
293
|
+
plus(amountToAdd: number, unit: TemporalUnit): YearWeek;
|
|
294
|
+
plus(amountToAdd: TemporalAmount): YearWeek;
|
|
295
|
+
plusWeeks(weeksToAdd: number): YearWeek;
|
|
296
|
+
plusYears(yearsToAdd: number): YearWeek;
|
|
297
|
+
query<R>(query: TemporalQuery<R>): R | null;
|
|
298
|
+
range(field: TemporalField): ValueRange;
|
|
299
|
+
toString(): string;
|
|
300
|
+
until(endExclusive: Temporal, unit: TemporalUnit): number;
|
|
301
|
+
with(adjuster: TemporalAdjuster): YearWeek;
|
|
302
|
+
with(field: TemporalField, newValue: number): YearWeek;
|
|
303
|
+
withWeek(week: number): YearWeek;
|
|
304
|
+
withYear(weekBasedYear: number): YearWeek;
|
|
305
|
+
|
|
306
|
+
protected _minusUnit(amountToSubtract: number, unit: TemporalUnit): YearWeek;
|
|
307
|
+
protected _minusAmount(amount: TemporalAmount): YearWeek;
|
|
308
|
+
protected _plusUnit(amountToAdd: number, unit: TemporalUnit): YearWeek;
|
|
309
|
+
protected _plusAmount(amount: TemporalAmount): YearWeek;
|
|
310
|
+
protected _withAdjuster(adjuster: TemporalAdjuster): YearWeek;
|
|
311
|
+
protected _withField(field: TemporalField, newValue: number): YearWeek;
|
|
312
|
+
}
|
|
313
|
+
|
|
82
314
|
export const __esModule: true;
|
|
83
315
|
export as namespace JSJodaExtra;
|