@naturalcycles/js-lib 14.235.0 → 14.237.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.
Files changed (43) hide show
  1. package/dist/datetime/localDate.d.ts +2 -1
  2. package/dist/datetime/localDate.js +7 -0
  3. package/dist/datetime/localTime.d.ts +67 -26
  4. package/dist/datetime/localTime.js +99 -33
  5. package/dist/datetime/wallTime.d.ts +33 -0
  6. package/dist/datetime/wallTime.js +48 -0
  7. package/dist/index.d.ts +1 -5
  8. package/dist/index.js +1 -5
  9. package/dist-esm/array/range.js +4 -7
  10. package/dist-esm/datetime/localDate.js +7 -0
  11. package/dist-esm/datetime/localTime.js +105 -35
  12. package/dist-esm/datetime/wallTime.js +44 -0
  13. package/dist-esm/decorators/asyncMemo.decorator.js +1 -1
  14. package/dist-esm/decorators/createPromiseDecorator.js +10 -5
  15. package/dist-esm/decorators/debounce.js +6 -1
  16. package/dist-esm/decorators/memo.decorator.js +1 -1
  17. package/dist-esm/define.js +14 -2
  18. package/dist-esm/enum.util.js +1 -2
  19. package/dist-esm/error/assert.js +12 -3
  20. package/dist-esm/error/error.util.js +13 -8
  21. package/dist-esm/error/tryCatch.js +1 -1
  22. package/dist-esm/http/fetcher.js +74 -41
  23. package/dist-esm/index.js +1 -5
  24. package/dist-esm/iter/asyncIterable2.js +37 -122
  25. package/dist-esm/json-schema/jsonSchema.util.js +2 -3
  26. package/dist-esm/json-schema/jsonSchemaBuilder.js +1 -2
  27. package/dist-esm/math/math.util.js +1 -1
  28. package/dist-esm/object/object.util.js +4 -5
  29. package/dist-esm/polyfill.js +2 -3
  30. package/dist-esm/promise/abortable.js +1 -2
  31. package/dist-esm/promise/pMap.js +3 -3
  32. package/dist-esm/promise/pQueue.js +7 -2
  33. package/dist-esm/string/json.util.js +3 -3
  34. package/dist-esm/string/readingTime.js +4 -1
  35. package/dist-esm/string/safeJsonStringify.js +2 -2
  36. package/dist-esm/string/stringify.js +1 -1
  37. package/dist-esm/web.js +2 -4
  38. package/dist-esm/zod/zod.util.js +1 -2
  39. package/package.json +1 -1
  40. package/src/datetime/localDate.ts +9 -1
  41. package/src/datetime/localTime.ts +110 -37
  42. package/src/datetime/wallTime.ts +56 -0
  43. package/src/index.ts +1 -5
@@ -1,6 +1,6 @@
1
1
  import { Iterable2 } from '../iter/iterable2';
2
2
  import type { Inclusiveness, IsoDateString, IsoDateTimeString, MonthId, SortDirection, UnixTimestampMillisNumber, UnixTimestampNumber } from '../types';
3
- import { ISODayOfWeek, LocalTime } from './localTime';
3
+ import { DateObject, ISODayOfWeek, LocalTime } from './localTime';
4
4
  export type LocalDateUnit = LocalDateUnitStrict | 'week';
5
5
  export type LocalDateUnitStrict = 'year' | 'month' | 'day';
6
6
  export type LocalDateInput = LocalDate | Date | IsoDateString;
@@ -103,6 +103,7 @@ export declare class LocalDate {
103
103
  * Unlike normal `.toDate` that uses browser's timezone by default.
104
104
  */
105
105
  toDateInUTC(): Date;
106
+ toDateObject(): DateObject;
106
107
  /**
107
108
  * Converts LocalDate to LocalTime with 0 hours, 0 minutes, 0 seconds.
108
109
  * LocalTime's Date will be in local timezone.
@@ -323,6 +323,13 @@ class LocalDate {
323
323
  toDateInUTC() {
324
324
  return new Date(this.toISODateTimeInUTC());
325
325
  }
326
+ toDateObject() {
327
+ return {
328
+ year: this.$year,
329
+ month: this.$month,
330
+ day: this.$day,
331
+ };
332
+ }
326
333
  /**
327
334
  * Converts LocalDate to LocalTime with 0 hours, 0 minutes, 0 seconds.
328
335
  * LocalTime's Date will be in local timezone.
@@ -1,5 +1,6 @@
1
1
  import type { Inclusiveness, IsoDateString, IsoDateTimeString, MonthId, NumberOfHours, NumberOfMinutes, SortDirection, UnixTimestampMillisNumber, UnixTimestampNumber } from '../types';
2
2
  import { LocalDate } from './localDate';
3
+ import { WallTime } from './wallTime';
3
4
  export type LocalTimeUnit = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
4
5
  export declare enum ISODayOfWeek {
5
6
  MONDAY = 1,
@@ -12,13 +13,13 @@ export declare enum ISODayOfWeek {
12
13
  }
13
14
  export type LocalTimeInput = LocalTime | Date | IsoDateTimeString | UnixTimestampNumber;
14
15
  export type LocalTimeFormatter = (ld: LocalTime) => string;
15
- export type LocalTimeComponents = DateComponents & TimeComponents;
16
- interface DateComponents {
16
+ export type DateTimeObject = DateObject & TimeObject;
17
+ export interface DateObject {
17
18
  year: number;
18
19
  month: number;
19
20
  day: number;
20
21
  }
21
- interface TimeComponents {
22
+ export interface TimeObject {
22
23
  hour: number;
23
24
  minute: number;
24
25
  second: number;
@@ -36,6 +37,51 @@ export declare class LocalTime {
36
37
  * Opposite of `.utc()` method.
37
38
  */
38
39
  local(): LocalTime;
40
+ /**
41
+ * Returns [cloned] fake LocalTime that has yyyy-mm-dd hh:mm:ss in the provided timezone.
42
+ * It is a fake LocalTime in a sense that it's timezone is not real.
43
+ * See this ("common errors"): https://stackoverflow.com/a/15171030/4919972
44
+ * Fake also means that unixTimestamp of that new LocalDate is not the same.
45
+ * For that reason we return WallTime, and not a LocalTime.
46
+ * WallTime can be pretty-printed as Date-only, Time-only or DateAndTime.
47
+ *
48
+ * E.g `inTimezone('America/New_York').toISOTime()`
49
+ *
50
+ * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
51
+ *
52
+ * @experimental
53
+ */
54
+ inTimezone(tz: string): WallTime;
55
+ /**
56
+ * UTC offset is the opposite of "timezone offset" - it's the number of minutes to add
57
+ * to the local time to get UTC time.
58
+ *
59
+ * E.g utcOffset for CEST is -120,
60
+ * which means that you need to add -120 minutes to the local time to get UTC time.
61
+ *
62
+ * Instead of -0 it returns 0, for the peace of mind and less weird test/snapshot differences.
63
+ *
64
+ * If timezone (tz) is specified, e.g `America/New_York`,
65
+ * it will return the UTC offset for that timezone.
66
+ *
67
+ * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
68
+ */
69
+ getUTCOffsetMinutes(tz?: string): NumberOfMinutes;
70
+ /**
71
+ * Same as getUTCOffsetMinutes, but rounded to hours.
72
+ *
73
+ * E.g for CEST it is -2.
74
+ *
75
+ * Instead of -0 it returns 0, for the peace of mind and less weird test/snapshot differences.
76
+ *
77
+ * If timezone (tz) is specified, e.g `America/New_York`,
78
+ * it will return the UTC offset for that timezone.
79
+ */
80
+ getUTCOffsetHours(tz?: string): NumberOfHours;
81
+ /**
82
+ * Returns e.g `-05:00` for New_York winter time.
83
+ */
84
+ getUTCOffsetString(tz: string): string;
39
85
  get(unit: LocalTimeUnit): number;
40
86
  set(unit: LocalTimeUnit, v: number, mutate?: boolean): LocalTime;
41
87
  year(): number;
@@ -57,7 +103,7 @@ export declare class LocalTime {
57
103
  minute(v: number): LocalTime;
58
104
  second(): number;
59
105
  second(v: number): LocalTime;
60
- setComponents(c: Partial<LocalTimeComponents>, mutate?: boolean): LocalTime;
106
+ setComponents(c: Partial<DateTimeObject>, mutate?: boolean): LocalTime;
61
107
  plusSeconds(num: number): LocalTime;
62
108
  plusMinutes(num: number): LocalTime;
63
109
  plusHours(num: number): LocalTime;
@@ -123,9 +169,9 @@ export declare class LocalTime {
123
169
  * returns -1 if this < d
124
170
  */
125
171
  cmp(d: LocalTimeInput): -1 | 0 | 1;
126
- components(): LocalTimeComponents;
127
- private dateComponents;
128
- private timeComponents;
172
+ getDateTimeObject(): DateTimeObject;
173
+ getDateObject(): DateObject;
174
+ getTimeObject(): TimeObject;
129
175
  fromNow(now?: LocalTimeInput): string;
130
176
  getDate(): Date;
131
177
  clone(): LocalTime;
@@ -177,6 +223,19 @@ declare class LocalTimeFactory {
177
223
  parseToDate(d: LocalTimeInput): Date;
178
224
  parseToUnixTimestamp(d: LocalTimeInput): UnixTimestampNumber;
179
225
  isValid(d: LocalTimeInput | undefined | null): boolean;
226
+ /**
227
+ * Returns the IANA timezone e.g `Europe/Stockholm`.
228
+ * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
229
+ */
230
+ getTimezone(): string;
231
+ /**
232
+ * Returns true if passed IANA timezone is valid/supported.
233
+ * E.g `Europe/Stockholm` is valid, but `Europe/Stockholm2` is not.
234
+ *
235
+ * This implementation is not optimized for performance. If you need frequent validation -
236
+ * consider caching the Intl.supportedValuesOf values as Set and reuse that.
237
+ */
238
+ isTimezoneValid(tz: string): boolean;
180
239
  now(): LocalTime;
181
240
  /**
182
241
  * Creates a LocalTime from the input, unless it's falsy - then returns undefined.
@@ -191,7 +250,7 @@ declare class LocalTimeFactory {
191
250
  fromComponents(c: {
192
251
  year: number;
193
252
  month: number;
194
- } & Partial<LocalTimeComponents>): LocalTime;
253
+ } & Partial<DateTimeObject>): LocalTime;
195
254
  sort(items: LocalTime[], dir?: SortDirection, mutate?: boolean): LocalTime[];
196
255
  minOrUndefined(items: LocalTimeInput[]): LocalTime | undefined;
197
256
  min(items: LocalTimeInput[]): LocalTime;
@@ -207,22 +266,4 @@ export declare const localTime: LocalTimeFn;
207
266
  Like Date.now(), but in seconds.
208
267
  */
209
268
  export declare function nowUnix(): UnixTimestampNumber;
210
- /**
211
- * UTC offset is the opposite of "timezone offset" - it's the number of minutes to add
212
- * to the local time to get UTC time.
213
- *
214
- * E.g utcOffset for CEST is -120,
215
- * which means that you need to add -120 minutes to the local time to get UTC time.
216
- *
217
- * Instead of -0 it returns 0, for the peace of mind and less weird test/snapshot differences.
218
- */
219
- export declare function getUTCOffsetMinutes(): NumberOfMinutes;
220
- /**
221
- * Same as getUTCOffsetMinutes, but rounded to hours.
222
- *
223
- * E.g for CEST it is -2.
224
- *
225
- * Instead of -0 it returns 0, for the peace of mind and less weird test/snapshot differences.
226
- */
227
- export declare function getUTCOffsetHours(): NumberOfHours;
228
269
  export {};
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUTCOffsetHours = exports.getUTCOffsetMinutes = exports.nowUnix = exports.localTime = exports.LocalTime = exports.ISODayOfWeek = void 0;
3
+ exports.nowUnix = exports.localTime = exports.LocalTime = exports.ISODayOfWeek = void 0;
4
4
  const assert_1 = require("../error/assert");
5
5
  const time_util_1 = require("../time/time.util");
6
6
  const localDate_1 = require("./localDate");
7
+ const wallTime_1 = require("./wallTime");
7
8
  var ISODayOfWeek;
8
9
  (function (ISODayOfWeek) {
9
10
  ISODayOfWeek[ISODayOfWeek["MONDAY"] = 1] = "MONDAY";
@@ -38,6 +39,78 @@ class LocalTime {
38
39
  local() {
39
40
  return new LocalTime(new Date(this.$date.getTime()));
40
41
  }
42
+ /**
43
+ * Returns [cloned] fake LocalTime that has yyyy-mm-dd hh:mm:ss in the provided timezone.
44
+ * It is a fake LocalTime in a sense that it's timezone is not real.
45
+ * See this ("common errors"): https://stackoverflow.com/a/15171030/4919972
46
+ * Fake also means that unixTimestamp of that new LocalDate is not the same.
47
+ * For that reason we return WallTime, and not a LocalTime.
48
+ * WallTime can be pretty-printed as Date-only, Time-only or DateAndTime.
49
+ *
50
+ * E.g `inTimezone('America/New_York').toISOTime()`
51
+ *
52
+ * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
53
+ *
54
+ * @experimental
55
+ */
56
+ inTimezone(tz) {
57
+ const d = new Date(this.$date.toLocaleString('en-US', { timeZone: tz }));
58
+ return new wallTime_1.WallTime({
59
+ year: d.getFullYear(),
60
+ month: d.getMonth() + 1,
61
+ day: d.getDate(),
62
+ hour: d.getHours(),
63
+ minute: d.getMinutes(),
64
+ second: d.getSeconds(),
65
+ });
66
+ }
67
+ /**
68
+ * UTC offset is the opposite of "timezone offset" - it's the number of minutes to add
69
+ * to the local time to get UTC time.
70
+ *
71
+ * E.g utcOffset for CEST is -120,
72
+ * which means that you need to add -120 minutes to the local time to get UTC time.
73
+ *
74
+ * Instead of -0 it returns 0, for the peace of mind and less weird test/snapshot differences.
75
+ *
76
+ * If timezone (tz) is specified, e.g `America/New_York`,
77
+ * it will return the UTC offset for that timezone.
78
+ *
79
+ * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
80
+ */
81
+ getUTCOffsetMinutes(tz) {
82
+ if (tz) {
83
+ // based on: https://stackoverflow.com/a/53652131/4919972
84
+ const nowTime = this.$date.getTime();
85
+ const tzTime = new Date(this.$date.toLocaleString('en-US', { timeZone: tz })).getTime();
86
+ return Math.round((tzTime - nowTime) / 60000) || 0;
87
+ }
88
+ return -this.$date.getTimezoneOffset() || 0;
89
+ }
90
+ /**
91
+ * Same as getUTCOffsetMinutes, but rounded to hours.
92
+ *
93
+ * E.g for CEST it is -2.
94
+ *
95
+ * Instead of -0 it returns 0, for the peace of mind and less weird test/snapshot differences.
96
+ *
97
+ * If timezone (tz) is specified, e.g `America/New_York`,
98
+ * it will return the UTC offset for that timezone.
99
+ */
100
+ getUTCOffsetHours(tz) {
101
+ return Math.round(this.getUTCOffsetMinutes(tz) / 60);
102
+ }
103
+ /**
104
+ * Returns e.g `-05:00` for New_York winter time.
105
+ */
106
+ getUTCOffsetString(tz) {
107
+ const minutes = this.getUTCOffsetMinutes(tz);
108
+ const hours = Math.trunc(minutes / 60);
109
+ const sign = hours < 0 ? '-' : '+';
110
+ const h = String(Math.abs(hours)).padStart(2, '0');
111
+ const m = String(minutes % 60).padStart(2, '0');
112
+ return `${sign}${h}:${m}`;
113
+ }
41
114
  get(unit) {
42
115
  if (unit === 'year') {
43
116
  return this.$date.getFullYear();
@@ -357,20 +430,20 @@ class LocalTime {
357
430
  return 0;
358
431
  return t1 < t2 ? -1 : 1;
359
432
  }
360
- components() {
433
+ getDateTimeObject() {
361
434
  return {
362
- ...this.dateComponents(),
363
- ...this.timeComponents(),
435
+ ...this.getDateObject(),
436
+ ...this.getTimeObject(),
364
437
  };
365
438
  }
366
- dateComponents() {
439
+ getDateObject() {
367
440
  return {
368
441
  year: this.$date.getFullYear(),
369
442
  month: this.$date.getMonth() + 1,
370
443
  day: this.$date.getDate(),
371
444
  };
372
445
  }
373
- timeComponents() {
446
+ getTimeObject() {
374
447
  return {
375
448
  hour: this.$date.getHours(),
376
449
  minute: this.$date.getMinutes(),
@@ -427,7 +500,7 @@ class LocalTime {
427
500
  * Returns e.g: `1984-06-21`, only the date part of DateTime
428
501
  */
429
502
  toISODate() {
430
- const { year, month, day } = this.dateComponents();
503
+ const { year, month, day } = this.getDateObject();
431
504
  return [
432
505
  String(year).padStart(4, '0'),
433
506
  String(month).padStart(2, '0'),
@@ -440,7 +513,7 @@ class LocalTime {
440
513
  * Returns e.g: `17:03:15` (or `17:03` with seconds=false)
441
514
  */
442
515
  toISOTime(seconds = true) {
443
- const { hour, minute, second } = this.timeComponents();
516
+ const { hour, minute, second } = this.getTimeObject();
444
517
  return [
445
518
  String(hour).padStart(2, '0'),
446
519
  String(minute).padStart(2, '0'),
@@ -455,7 +528,7 @@ class LocalTime {
455
528
  * Returns e.g: `19840621_1705`
456
529
  */
457
530
  toStringCompact(seconds = false) {
458
- const { year, month, day, hour, minute, second } = this.components();
531
+ const { year, month, day, hour, minute, second } = this.getDateTimeObject();
459
532
  return [
460
533
  String(year).padStart(4, '0'),
461
534
  String(month).padStart(2, '0'),
@@ -560,6 +633,23 @@ class LocalTimeFactory {
560
633
  isValid(d) {
561
634
  return this.parseOrNull(d) !== null;
562
635
  }
636
+ /**
637
+ * Returns the IANA timezone e.g `Europe/Stockholm`.
638
+ * https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
639
+ */
640
+ getTimezone() {
641
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
642
+ }
643
+ /**
644
+ * Returns true if passed IANA timezone is valid/supported.
645
+ * E.g `Europe/Stockholm` is valid, but `Europe/Stockholm2` is not.
646
+ *
647
+ * This implementation is not optimized for performance. If you need frequent validation -
648
+ * consider caching the Intl.supportedValuesOf values as Set and reuse that.
649
+ */
650
+ isTimezoneValid(tz) {
651
+ return Intl.supportedValuesOf('timeZone').includes(tz);
652
+ }
563
653
  now() {
564
654
  return new LocalTime(new Date());
565
655
  }
@@ -710,27 +800,3 @@ function nowUnix() {
710
800
  return Math.floor(Date.now() / 1000);
711
801
  }
712
802
  exports.nowUnix = nowUnix;
713
- /**
714
- * UTC offset is the opposite of "timezone offset" - it's the number of minutes to add
715
- * to the local time to get UTC time.
716
- *
717
- * E.g utcOffset for CEST is -120,
718
- * which means that you need to add -120 minutes to the local time to get UTC time.
719
- *
720
- * Instead of -0 it returns 0, for the peace of mind and less weird test/snapshot differences.
721
- */
722
- function getUTCOffsetMinutes() {
723
- return -new Date().getTimezoneOffset() || 0;
724
- }
725
- exports.getUTCOffsetMinutes = getUTCOffsetMinutes;
726
- /**
727
- * Same as getUTCOffsetMinutes, but rounded to hours.
728
- *
729
- * E.g for CEST it is -2.
730
- *
731
- * Instead of -0 it returns 0, for the peace of mind and less weird test/snapshot differences.
732
- */
733
- function getUTCOffsetHours() {
734
- return Math.round(getUTCOffsetMinutes() / 60);
735
- }
736
- exports.getUTCOffsetHours = getUTCOffsetHours;
@@ -0,0 +1,33 @@
1
+ import { DateTimeObject } from './localTime';
2
+ /**
3
+ * Representation of a "time on the wall clock",
4
+ * which means "local time, regardless of timezone".
5
+ *
6
+ * Experimental simplified container object to hold
7
+ * date and time components as numbers.
8
+ * No math or manipulation is possible here.
9
+ * Can be pretty-printed as Date, Time or DateAndTime.
10
+ */
11
+ export declare class WallTime implements DateTimeObject {
12
+ year: number;
13
+ month: number;
14
+ day: number;
15
+ hour: number;
16
+ minute: number;
17
+ second: number;
18
+ constructor(obj: DateTimeObject);
19
+ /**
20
+ * Returns e.g: `1984-06-21 17:56:21`
21
+ * or (if seconds=false):
22
+ * `1984-06-21 17:56`
23
+ */
24
+ toPretty(seconds?: boolean): string;
25
+ /**
26
+ * Returns e.g: `1984-06-21`, only the date part of DateTime
27
+ */
28
+ toISODate(): string;
29
+ /**
30
+ * Returns e.g: `17:03:15` (or `17:03` with seconds=false)
31
+ */
32
+ toISOTime(seconds?: boolean): string;
33
+ }
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.WallTime = void 0;
4
+ /**
5
+ * Representation of a "time on the wall clock",
6
+ * which means "local time, regardless of timezone".
7
+ *
8
+ * Experimental simplified container object to hold
9
+ * date and time components as numbers.
10
+ * No math or manipulation is possible here.
11
+ * Can be pretty-printed as Date, Time or DateAndTime.
12
+ */
13
+ class WallTime {
14
+ constructor(obj) {
15
+ Object.assign(this, obj);
16
+ }
17
+ /**
18
+ * Returns e.g: `1984-06-21 17:56:21`
19
+ * or (if seconds=false):
20
+ * `1984-06-21 17:56`
21
+ */
22
+ toPretty(seconds = true) {
23
+ return this.toISODate() + ' ' + this.toISOTime(seconds);
24
+ }
25
+ /**
26
+ * Returns e.g: `1984-06-21`, only the date part of DateTime
27
+ */
28
+ toISODate() {
29
+ return [
30
+ String(this.year).padStart(4, '0'),
31
+ String(this.month).padStart(2, '0'),
32
+ String(this.day).padStart(2, '0'),
33
+ ].join('-');
34
+ }
35
+ /**
36
+ * Returns e.g: `17:03:15` (or `17:03` with seconds=false)
37
+ */
38
+ toISOTime(seconds = true) {
39
+ return [
40
+ String(this.hour).padStart(2, '0'),
41
+ String(this.minute).padStart(2, '0'),
42
+ seconds && String(this.second).padStart(2, '0'),
43
+ ]
44
+ .filter(Boolean)
45
+ .join(':');
46
+ }
47
+ }
48
+ exports.WallTime = WallTime;
package/dist/index.d.ts CHANGED
@@ -26,7 +26,6 @@ export * from './json-schema/jsonSchema.cnst';
26
26
  export * from './json-schema/jsonSchema.model';
27
27
  export * from './json-schema/jsonSchema.util';
28
28
  export * from './json-schema/jsonSchemaBuilder';
29
- export * from './json-schema/jsonSchemaBuilder';
30
29
  export * from './math/math.util';
31
30
  export * from './math/sma';
32
31
  export * from './number/createDeterministicRandom';
@@ -68,10 +67,7 @@ export * from './math/stack.util';
68
67
  export * from './string/leven';
69
68
  export * from './datetime/localDate';
70
69
  export * from './datetime/localTime';
71
- export * from './datetime/dateInterval';
72
- export * from './datetime/timeInterval';
73
- export * from './datetime/localDate';
74
- export * from './datetime/localTime';
70
+ export * from './datetime/wallTime';
75
71
  export * from './datetime/dateInterval';
76
72
  export * from './datetime/timeInterval';
77
73
  export * from './env';
package/dist/index.js CHANGED
@@ -30,7 +30,6 @@ tslib_1.__exportStar(require("./json-schema/jsonSchema.cnst"), exports);
30
30
  tslib_1.__exportStar(require("./json-schema/jsonSchema.model"), exports);
31
31
  tslib_1.__exportStar(require("./json-schema/jsonSchema.util"), exports);
32
32
  tslib_1.__exportStar(require("./json-schema/jsonSchemaBuilder"), exports);
33
- tslib_1.__exportStar(require("./json-schema/jsonSchemaBuilder"), exports);
34
33
  tslib_1.__exportStar(require("./math/math.util"), exports);
35
34
  tslib_1.__exportStar(require("./math/sma"), exports);
36
35
  tslib_1.__exportStar(require("./number/createDeterministicRandom"), exports);
@@ -72,10 +71,7 @@ tslib_1.__exportStar(require("./math/stack.util"), exports);
72
71
  tslib_1.__exportStar(require("./string/leven"), exports);
73
72
  tslib_1.__exportStar(require("./datetime/localDate"), exports);
74
73
  tslib_1.__exportStar(require("./datetime/localTime"), exports);
75
- tslib_1.__exportStar(require("./datetime/dateInterval"), exports);
76
- tslib_1.__exportStar(require("./datetime/timeInterval"), exports);
77
- tslib_1.__exportStar(require("./datetime/localDate"), exports);
78
- tslib_1.__exportStar(require("./datetime/localTime"), exports);
74
+ tslib_1.__exportStar(require("./datetime/wallTime"), exports);
79
75
  tslib_1.__exportStar(require("./datetime/dateInterval"), exports);
80
76
  tslib_1.__exportStar(require("./datetime/timeInterval"), exports);
81
77
  tslib_1.__exportStar(require("./env"), exports);
@@ -1,4 +1,3 @@
1
- import { __asyncGenerator, __await } from "tslib";
2
1
  import { AsyncIterable2 } from '../iter/asyncIterable2';
3
2
  import { Iterable2 } from '../iter/iterable2';
4
3
  export function _range(fromIncl, toExcl, step = 1) {
@@ -26,12 +25,10 @@ export function _rangeAsyncIterable(fromIncl, toExcl, step = 1) {
26
25
  fromIncl = 0;
27
26
  }
28
27
  return AsyncIterable2.of({
29
- [Symbol.asyncIterator]() {
30
- return __asyncGenerator(this, arguments, function* _a() {
31
- for (let i = fromIncl; i < toExcl; i += step) {
32
- yield yield __await(i);
33
- }
34
- });
28
+ async *[Symbol.asyncIterator]() {
29
+ for (let i = fromIncl; i < toExcl; i += step) {
30
+ yield i;
31
+ }
35
32
  },
36
33
  });
37
34
  }
@@ -320,6 +320,13 @@ export class LocalDate {
320
320
  toDateInUTC() {
321
321
  return new Date(this.toISODateTimeInUTC());
322
322
  }
323
+ toDateObject() {
324
+ return {
325
+ year: this.$year,
326
+ month: this.$month,
327
+ day: this.$day,
328
+ };
329
+ }
323
330
  /**
324
331
  * Converts LocalDate to LocalTime with 0 hours, 0 minutes, 0 seconds.
325
332
  * LocalTime's Date will be in local timezone.