@naturalcycles/js-lib 14.96.0 → 14.97.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.
@@ -48,7 +48,7 @@ class LocalTime {
48
48
  date = new Date(d * 1000);
49
49
  }
50
50
  else {
51
- date = new Date(d);
51
+ date = new Date(d.slice(0, 19));
52
52
  }
53
53
  // validation
54
54
  if (isNaN(date.getDate())) {
@@ -60,6 +60,28 @@ class LocalTime {
60
60
  // }
61
61
  return new LocalTime(date, false);
62
62
  }
63
+ static parseToDate(d) {
64
+ if (d instanceof LocalTime)
65
+ return d.$date;
66
+ if (d instanceof Date)
67
+ return d;
68
+ const date = typeof d === 'number' ? new Date(d * 1000) : new Date(d);
69
+ if (isNaN(date.getDate())) {
70
+ throw new TypeError(`Cannot parse "${d}" to Date`);
71
+ }
72
+ return date;
73
+ }
74
+ static parseToUnixTimestamp(d) {
75
+ if (typeof d === 'number')
76
+ return d;
77
+ if (d instanceof LocalTime)
78
+ return d.unix();
79
+ const date = d instanceof Date ? d : new Date(d);
80
+ if (isNaN(date.getDate())) {
81
+ throw new TypeError(`Cannot parse "${d}" to UnixTimestamp`);
82
+ }
83
+ return date.valueOf() / 1000;
84
+ }
63
85
  static isValid(d) {
64
86
  return this.parseOrNull(d) !== null;
65
87
  }
@@ -118,7 +140,7 @@ class LocalTime {
118
140
  month(v) {
119
141
  return v === undefined ? this.get('month') : this.set('month', v);
120
142
  }
121
- date(v) {
143
+ day(v) {
122
144
  return v === undefined ? this.get('day') : this.set('day', v);
123
145
  }
124
146
  hour(v) {
@@ -164,7 +186,7 @@ class LocalTime {
164
186
  return Math.abs(this.diff(other, unit));
165
187
  }
166
188
  diff(other, unit) {
167
- const date2 = LocalTime.of(other).$date;
189
+ const date2 = LocalTime.parseToDate(other);
168
190
  if (unit === 'year') {
169
191
  return this.$date.getFullYear() - date2.getFullYear();
170
192
  }
@@ -241,14 +263,16 @@ class LocalTime {
241
263
  isSame(d) {
242
264
  return this.cmp(d) === 0;
243
265
  }
244
- isBefore(d) {
245
- return this.cmp(d) === -1;
266
+ isBefore(d, inclusive = false) {
267
+ const r = this.cmp(d);
268
+ return r === -1 || (r === 0 && inclusive);
246
269
  }
247
270
  isSameOrBefore(d) {
248
271
  return this.cmp(d) <= 0;
249
272
  }
250
- isAfter(d) {
251
- return this.cmp(d) === 1;
273
+ isAfter(d, inclusive = false) {
274
+ const r = this.cmp(d);
275
+ return r === 1 || (r === 0 && inclusive);
252
276
  }
253
277
  isSameOrAfter(d) {
254
278
  return this.cmp(d) >= 0;
@@ -269,7 +293,7 @@ class LocalTime {
269
293
  */
270
294
  cmp(d) {
271
295
  const t1 = this.$date.valueOf();
272
- const t2 = LocalTime.of(d).$date.valueOf();
296
+ const t2 = LocalTime.parseToDate(d).valueOf();
273
297
  if (t1 === t2)
274
298
  return 0;
275
299
  return t1 < t2 ? -1 : 1;
@@ -295,8 +319,8 @@ class LocalTime {
295
319
  second: this.$date.getSeconds(),
296
320
  };
297
321
  }
298
- fromNow(now = LocalTime.now()) {
299
- const msDiff = LocalTime.of(now).unixMillis() - this.unixMillis();
322
+ fromNow(now = new Date()) {
323
+ const msDiff = LocalTime.parseToDate(now).valueOf() - this.$date.valueOf();
300
324
  if (msDiff === 0)
301
325
  return 'now';
302
326
  if (msDiff >= 0) {
@@ -408,4 +432,3 @@ function localTime(d) {
408
432
  return d ? LocalTime.of(d) : LocalTime.now();
409
433
  }
410
434
  exports.localTime = localTime;
411
- // todo: range
@@ -0,0 +1,38 @@
1
+ import { UnixTimestampNumber } from '../types';
2
+ import { Inclusiveness } from './localDate';
3
+ import { LocalTime, LocalTimeConfig } from './localTime';
4
+ export declare type TimeIntervalConfig = TimeInterval | TimeIntervalString;
5
+ export declare type TimeIntervalString = string;
6
+ /**
7
+ * Class that supports an "interval of time" between 2 timestamps - start and end.
8
+ * Example: `1649267185/1649267187`.
9
+ *
10
+ * @experimental
11
+ */
12
+ export declare class TimeInterval {
13
+ private $start;
14
+ private $end;
15
+ private constructor();
16
+ static of(start: LocalTimeConfig, end: LocalTimeConfig): TimeInterval;
17
+ get start(): UnixTimestampNumber;
18
+ get end(): UnixTimestampNumber;
19
+ get startTime(): LocalTime;
20
+ get endTime(): LocalTime;
21
+ /**
22
+ * Parses string like `1649267185/1649267187` into a TimeInterval.
23
+ */
24
+ static parse(d: TimeIntervalConfig): TimeInterval;
25
+ isSame(d: TimeIntervalConfig): boolean;
26
+ isBefore(d: TimeIntervalConfig, inclusive?: boolean): boolean;
27
+ isSameOrBefore(d: TimeIntervalConfig): boolean;
28
+ isAfter(d: TimeIntervalConfig, inclusive?: boolean): boolean;
29
+ isSameOrAfter(d: TimeIntervalConfig): boolean;
30
+ includes(d: LocalTimeConfig, incl?: Inclusiveness): boolean;
31
+ /**
32
+ * TimeIntervals compare by start date.
33
+ * If it's the same - then by end date.
34
+ */
35
+ cmp(d: TimeIntervalConfig): -1 | 0 | 1;
36
+ toString(): TimeIntervalString;
37
+ toJSON(): TimeIntervalString;
38
+ }
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TimeInterval = void 0;
4
+ const localTime_1 = require("./localTime");
5
+ /**
6
+ * Class that supports an "interval of time" between 2 timestamps - start and end.
7
+ * Example: `1649267185/1649267187`.
8
+ *
9
+ * @experimental
10
+ */
11
+ class TimeInterval {
12
+ constructor($start, $end) {
13
+ this.$start = $start;
14
+ this.$end = $end;
15
+ }
16
+ static of(start, end) {
17
+ return new TimeInterval(localTime_1.LocalTime.parseToUnixTimestamp(start), localTime_1.LocalTime.parseToUnixTimestamp(end));
18
+ }
19
+ get start() {
20
+ return this.$start;
21
+ }
22
+ get end() {
23
+ return this.$end;
24
+ }
25
+ get startTime() {
26
+ return localTime_1.LocalTime.of(this.$start);
27
+ }
28
+ get endTime() {
29
+ return localTime_1.LocalTime.of(this.$end);
30
+ }
31
+ /**
32
+ * Parses string like `1649267185/1649267187` into a TimeInterval.
33
+ */
34
+ static parse(d) {
35
+ if (d instanceof TimeInterval)
36
+ return d;
37
+ const [start, end] = d.split('/').map(Number);
38
+ if (!end || !start) {
39
+ throw new Error(`Cannot parse "${d}" into TimeInterval`);
40
+ }
41
+ return new TimeInterval(start, end);
42
+ }
43
+ isSame(d) {
44
+ return this.cmp(d) === 0;
45
+ }
46
+ isBefore(d, inclusive = false) {
47
+ const r = this.cmp(d);
48
+ return r === -1 || (r === 0 && inclusive);
49
+ }
50
+ isSameOrBefore(d) {
51
+ return this.cmp(d) <= 0;
52
+ }
53
+ isAfter(d, inclusive = false) {
54
+ const r = this.cmp(d);
55
+ return r === 1 || (r === 0 && inclusive);
56
+ }
57
+ isSameOrAfter(d) {
58
+ return this.cmp(d) >= 0;
59
+ }
60
+ includes(d, incl = '[)') {
61
+ d = localTime_1.LocalTime.parseToUnixTimestamp(d);
62
+ if (d < this.$start || (d === this.$start && incl[0] === '('))
63
+ return false;
64
+ if (d > this.$end || (d === this.$end && incl[1] === ')'))
65
+ return false;
66
+ return true;
67
+ }
68
+ /**
69
+ * TimeIntervals compare by start date.
70
+ * If it's the same - then by end date.
71
+ */
72
+ cmp(d) {
73
+ d = TimeInterval.parse(d);
74
+ if (this.$start > d.$start)
75
+ return 1;
76
+ if (this.$start < d.$start)
77
+ return -1;
78
+ if (this.$end > d.$end)
79
+ return 1;
80
+ if (this.$end < d.$end)
81
+ return -1;
82
+ return 0;
83
+ }
84
+ toString() {
85
+ return [this.$start, this.$end].join('/');
86
+ }
87
+ toJSON() {
88
+ return this.toString();
89
+ }
90
+ }
91
+ exports.TimeInterval = TimeInterval;
@@ -10,20 +10,26 @@ import { AppError } from './app.error';
10
10
  * For convenience, second argument type is non-optional,
11
11
  * so you can use it without `!`. But you SHOULD always check `if (err)` first!
12
12
  *
13
+ * ERR is typed as Error, not `unknown`. While unknown would be more correct,
14
+ * according to recent TypeScript, Error gives more developer convenience.
15
+ * In our code we NEVER throw non-errors.
16
+ * Only possibility of non-error is in the 3rd-party library code, in these cases it
17
+ * can be manually cast to `unknown` for extra safety.
18
+ *
13
19
  * @example
14
20
  *
15
21
  * const [err, v] = _try(() => someFunction())
16
22
  * if (err) ...do something...
17
23
  * v // go ahead and use v
18
24
  */
19
- export declare function _try<ERR = unknown, RETURN = void>(fn: () => RETURN): [err: ERR | null, value: RETURN];
25
+ export declare function _try<ERR = Error, RETURN = void>(fn: () => RETURN): [err: ERR | null, value: RETURN];
20
26
  /**
21
27
  * Like _try, but for Promises.
22
28
  *
23
29
  * Also, intentionally types second return item as non-optional,
24
30
  * but you should check for `err` presense first!
25
31
  */
26
- export declare function pTry<ERR = unknown, RETURN = void>(promise: Promise<RETURN>): Promise<[err: ERR | null, value: Awaited<RETURN>]>;
32
+ export declare function pTry<ERR = Error, RETURN = void>(promise: Promise<RETURN>): Promise<[err: ERR | null, value: Awaited<RETURN>]>;
27
33
  /**
28
34
  * It is thrown when Error was expected, but didn't happen
29
35
  * ("pass" happened instead).
package/dist/error/try.js CHANGED
@@ -12,6 +12,12 @@ const app_error_1 = require("./app.error");
12
12
  * For convenience, second argument type is non-optional,
13
13
  * so you can use it without `!`. But you SHOULD always check `if (err)` first!
14
14
  *
15
+ * ERR is typed as Error, not `unknown`. While unknown would be more correct,
16
+ * according to recent TypeScript, Error gives more developer convenience.
17
+ * In our code we NEVER throw non-errors.
18
+ * Only possibility of non-error is in the 3rd-party library code, in these cases it
19
+ * can be manually cast to `unknown` for extra safety.
20
+ *
15
21
  * @example
16
22
  *
17
23
  * const [err, v] = _try(() => someFunction())
@@ -49,7 +55,7 @@ exports.pTry = pTry;
49
55
  */
50
56
  class UnexpectedPassError extends app_error_1.AppError {
51
57
  constructor() {
52
- super('_expectedError passed unexpectedly');
58
+ super('expected error was not thrown');
53
59
  }
54
60
  }
55
61
  exports.UnexpectedPassError = UnexpectedPassError;
@@ -5,7 +5,7 @@ export interface TryCatchOptions {
5
5
  * The value returned from the function will be returned from the wrapped method (!).
6
6
  * onError function may be asynchronous.
7
7
  */
8
- onError?: (err: unknown) => any;
8
+ onError?: (err: Error) => any;
9
9
  /**
10
10
  * @default false
11
11
  */
@@ -30,7 +30,7 @@ function _tryCatch(fn, opt = {}) {
30
30
  }
31
31
  if (onError) {
32
32
  try {
33
- return await onError(err); // eslint-disable-line @typescript-eslint/return-await
33
+ return await onError((0, index_1._anyToError)(err)); // eslint-disable-line @typescript-eslint/return-await
34
34
  }
35
35
  catch { }
36
36
  }
package/dist/index.d.ts CHANGED
@@ -51,7 +51,7 @@ export * from './string/string.util';
51
51
  import { JsonStringifyFunction, StringifyAnyOptions, _stringifyAny } from './string/stringifyAny';
52
52
  export * from './time/time.util';
53
53
  import { Class, ConditionalExcept, ConditionalPick, Merge, Promisable, ReadonlyDeep, Simplify } from './typeFest';
54
- import { AsyncMapper, AsyncPredicate, BaseDBEntity, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, Saved, Unsaved, BatchResult, InstanceId, IsoDate, IsoDateTime, KeyValueTuple, Mapper, ObjectMapper, ObjectPredicate, Predicate, PromiseMap, AnyObject, AnyFunction, Reviver, SavedDBEntity, StringMap, UnixTimestamp, Integer, ValueOf, ValuesOf, AbortableMapper, AbortableAsyncPredicate, AbortableAsyncMapper, AbortablePredicate, END, SKIP, _noop, _objectKeys, _passNothingPredicate, _passthroughMapper, _passthroughPredicate, _passUndefinedMapper, _stringMapEntries, _stringMapValues } from './types';
54
+ import { AsyncMapper, AsyncPredicate, BaseDBEntity, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, Saved, Unsaved, BatchResult, InstanceId, IsoDate, IsoDateString, IsoDateTimeString, KeyValueTuple, Mapper, ObjectMapper, ObjectPredicate, Predicate, PromiseMap, AnyObject, AnyFunction, Reviver, SavedDBEntity, StringMap, UnixTimestampNumber, UnixTimestamp, Integer, ValueOf, ValuesOf, AbortableMapper, AbortableAsyncPredicate, AbortableAsyncMapper, AbortablePredicate, END, SKIP, _noop, _objectKeys, _passNothingPredicate, _passthroughMapper, _passthroughPredicate, _passUndefinedMapper, _stringMapEntries, _stringMapValues } from './types';
55
55
  export * from './unit/size.util';
56
56
  import { is } from './vendor/is';
57
57
  import { CommonLogLevel, CommonLogFunction, CommonLogger, commonLoggerMinLevel, commonLoggerNoop, commonLogLevelNumber, commonLoggerPipe, commonLoggerPrefix, CommonLogWithLevelFunction, commonLoggerCreate } from './log/commonLogger';
@@ -63,8 +63,10 @@ export * from './string/leven';
63
63
  export * from './datetime/localDate';
64
64
  export * from './datetime/localTime';
65
65
  export * from './datetime/dateInterval';
66
+ export * from './datetime/timeInterval';
66
67
  import { LocalDateConfig, LocalDateUnit, Inclusiveness } from './datetime/localDate';
67
68
  import { LocalTimeConfig, LocalTimeUnit, LocalTimeComponents } from './datetime/localTime';
68
69
  import { DateIntervalConfig, DateIntervalString } from './datetime/dateInterval';
69
- export type { DateIntervalConfig, DateIntervalString, LocalDateConfig, LocalDateUnit, Inclusiveness, LocalTimeConfig, LocalTimeUnit, LocalTimeComponents, AbortableMapper, AbortablePredicate, AbortableAsyncPredicate, AbortableAsyncMapper, PQueueCfg, MemoCache, AsyncMemoCache, PromiseDecoratorCfg, PromiseDecoratorResp, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse, Admin401ErrorData, Admin403ErrorData, StringMap, PromiseMap, AnyObject, AnyFunction, ValuesOf, ValueOf, KeyValueTuple, ObjectMapper, ObjectPredicate, InstanceId, IsoDate, IsoDateTime, Reviver, PMapOptions, Mapper, AsyncMapper, Predicate, AsyncPredicate, BatchResult, DeferredPromise, PRetryOptions, PTimeoutOptions, TryCatchOptions, StringifyAnyOptions, JsonStringifyFunction, Merge, ReadonlyDeep, Promisable, Simplify, ConditionalPick, ConditionalExcept, Class, UnixTimestamp, Integer, BaseDBEntity, SavedDBEntity, Saved, Unsaved, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, JsonSchema, JsonSchemaAny, JsonSchemaOneOf, JsonSchemaAllOf, JsonSchemaAnyOf, JsonSchemaNot, JsonSchemaRef, JsonSchemaConst, JsonSchemaEnum, JsonSchemaString, JsonSchemaNumber, JsonSchemaBoolean, JsonSchemaNull, JsonSchemaRootObject, JsonSchemaObject, JsonSchemaArray, JsonSchemaTuple, JsonSchemaBuilder, CommonLogLevel, CommonLogWithLevelFunction, CommonLogFunction, CommonLogger, };
70
+ import { TimeIntervalConfig, TimeIntervalString } from './datetime/timeInterval';
71
+ export type { DateIntervalConfig, DateIntervalString, TimeIntervalConfig, TimeIntervalString, LocalDateConfig, LocalDateUnit, Inclusiveness, LocalTimeConfig, LocalTimeUnit, LocalTimeComponents, AbortableMapper, AbortablePredicate, AbortableAsyncPredicate, AbortableAsyncMapper, PQueueCfg, MemoCache, AsyncMemoCache, PromiseDecoratorCfg, PromiseDecoratorResp, ErrorData, ErrorObject, HttpErrorData, HttpErrorResponse, Admin401ErrorData, Admin403ErrorData, StringMap, PromiseMap, AnyObject, AnyFunction, ValuesOf, ValueOf, KeyValueTuple, ObjectMapper, ObjectPredicate, InstanceId, IsoDate, IsoDateString, IsoDateTimeString, Reviver, PMapOptions, Mapper, AsyncMapper, Predicate, AsyncPredicate, BatchResult, DeferredPromise, PRetryOptions, PTimeoutOptions, TryCatchOptions, StringifyAnyOptions, JsonStringifyFunction, Merge, ReadonlyDeep, Promisable, Simplify, ConditionalPick, ConditionalExcept, Class, UnixTimestampNumber, UnixTimestamp, Integer, BaseDBEntity, SavedDBEntity, Saved, Unsaved, CreatedUpdated, CreatedUpdatedId, ObjectWithId, AnyObjectWithId, JsonSchema, JsonSchemaAny, JsonSchemaOneOf, JsonSchemaAllOf, JsonSchemaAnyOf, JsonSchemaNot, JsonSchemaRef, JsonSchemaConst, JsonSchemaEnum, JsonSchemaString, JsonSchemaNumber, JsonSchemaBoolean, JsonSchemaNull, JsonSchemaRootObject, JsonSchemaObject, JsonSchemaArray, JsonSchemaTuple, JsonSchemaBuilder, CommonLogLevel, CommonLogWithLevelFunction, CommonLogFunction, CommonLogger, };
70
72
  export { is, _createPromiseDecorator, _stringMapValues, _stringMapEntries, _objectKeys, pMap, _passthroughMapper, _passUndefinedMapper, _passthroughPredicate, _passNothingPredicate, _noop, ErrorMode, pDefer, AggregatedError, pRetry, pRetryFn, pTimeout, pTimeoutFn, _tryCatch, _TryCatch, _stringifyAny, jsonSchema, JsonSchemaAnyBuilder, commonLoggerMinLevel, commonLoggerNoop, commonLogLevelNumber, commonLoggerPipe, commonLoggerPrefix, commonLoggerCreate, PQueue, END, SKIP, };
package/dist/index.js CHANGED
@@ -95,3 +95,4 @@ tslib_1.__exportStar(require("./string/leven"), exports);
95
95
  tslib_1.__exportStar(require("./datetime/localDate"), exports);
96
96
  tslib_1.__exportStar(require("./datetime/localTime"), exports);
97
97
  tslib_1.__exportStar(require("./datetime/dateInterval"), exports);
98
+ tslib_1.__exportStar(require("./datetime/timeInterval"), exports);
package/dist/types.d.ts CHANGED
@@ -111,18 +111,26 @@ export interface InstanceId {
111
111
  *
112
112
  * @example '2019-06-21'
113
113
  */
114
+ export declare type IsoDateString = string;
115
+ /**
116
+ * @deprecated use IsoDateString
117
+ */
114
118
  export declare type IsoDate = string;
115
119
  /**
116
120
  * Interface explicitly states that the value is an ISO DateTime string (with time).
117
121
  *
118
122
  * @example '2019-06-21T05:21:73Z'
119
123
  */
120
- export declare type IsoDateTime = string;
124
+ export declare type IsoDateTimeString = string;
121
125
  /**
122
126
  * Interface explicitly states that the value is a Unix timestamp (in seconds).
123
127
  *
124
128
  * @example 1628945450
125
129
  */
130
+ export declare type UnixTimestampNumber = number;
131
+ /**
132
+ * @deprecated use UnixTimestampNumber
133
+ */
126
134
  export declare type UnixTimestamp = number;
127
135
  /**
128
136
  * Same as `number`, but with semantic meaning that it's an Integer.
@@ -136,11 +144,11 @@ export interface SavedDBEntity<ID = string> {
136
144
  /**
137
145
  * unixTimestamp of when the entity was first created (in the DB).
138
146
  */
139
- created: UnixTimestamp;
147
+ created: UnixTimestampNumber;
140
148
  /**
141
149
  * unixTimestamp of when the entity was last updated (in the DB).
142
150
  */
143
- updated: UnixTimestamp;
151
+ updated: UnixTimestampNumber;
144
152
  }
145
153
  /**
146
154
  * Base interface for any Entity that can be saved to DB.
@@ -27,14 +27,16 @@ export class DateInterval {
27
27
  isSame(d) {
28
28
  return this.cmp(d) === 0;
29
29
  }
30
- isBefore(d) {
31
- return this.cmp(d) === -1;
30
+ isBefore(d, inclusive = false) {
31
+ const r = this.cmp(d);
32
+ return r === -1 || (r === 0 && inclusive);
32
33
  }
33
34
  isSameOrBefore(d) {
34
35
  return this.cmp(d) <= 0;
35
36
  }
36
- isAfter(d) {
37
- return this.cmp(d) === 1;
37
+ isAfter(d, inclusive = false) {
38
+ const r = this.cmp(d);
39
+ return r === 1 || (r === 0 && inclusive);
38
40
  }
39
41
  isSameOrAfter(d) {
40
42
  return this.cmp(d) >= 0;
@@ -42,9 +44,14 @@ export class DateInterval {
42
44
  /**
43
45
  * Ranges of DateInterval (start, end) are INCLUSIVE.
44
46
  */
45
- includes(d) {
47
+ includes(d, incl = '[]') {
46
48
  d = LocalDate.of(d);
47
- return d.isSameOrAfter(this.start) && d.isSameOrBefore(this.end);
49
+ return d.isAfter(this.start, incl[0] === '[') && d.isBefore(this.end, incl[1] === ']');
50
+ }
51
+ intersects(int, inclusive = true) {
52
+ const $int = DateInterval.parse(int);
53
+ const incl = inclusive ? '[]' : '()';
54
+ return this.includes($int.start, incl) || this.includes($int.end, incl);
48
55
  }
49
56
  /**
50
57
  * DateIntervals compare by start date.
@@ -54,18 +61,14 @@ export class DateInterval {
54
61
  d = DateInterval.parse(d);
55
62
  return this.start.cmp(d.start) || this.end.cmp(d.end);
56
63
  }
64
+ getDays(incl = '[]') {
65
+ return LocalDate.range(this.start, this.end, incl, 1, 'day');
66
+ }
57
67
  /**
58
68
  * Returns an array of LocalDates that are included in the interval.
59
- * Ranges are INCLUSIVE.
60
69
  */
61
- getDays() {
62
- const days = [];
63
- let current = this.start;
64
- do {
65
- days.push(current);
66
- current = current.add(1, 'day');
67
- } while (current.isSameOrBefore(this.end));
68
- return days;
70
+ range(incl = '[]', step = 1, stepUnit = 'day') {
71
+ return LocalDate.range(this.start, this.end, incl, step, stepUnit);
69
72
  }
70
73
  toString() {
71
74
  return [this.start, this.end].join('/');