@dereekb/date 13.1.0 → 13.2.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/index.cjs.js CHANGED
@@ -2603,7 +2603,7 @@ function isKnownTimezone(input) {
2603
2603
  * const result = knownTimezoneType('America/Denver');
2604
2604
  * ```
2605
2605
  */
2606
- const knownTimezoneType = arktype.type('string > 0').narrow((val, ctx) => isKnownTimezone(val) || ctx.mustBe('a known timezone'));
2606
+ const knownTimezoneType = arktype.type('string > 0').narrow((val, ctx) => (val != null && isKnownTimezone(val)) || ctx.mustBe('a known timezone'));
2607
2607
 
2608
2608
  /**
2609
2609
  * Creates a {@link FitDateRangeToDayPeriodFunction} that collapses a multi-day date range into a single-day period within the given timezone.
@@ -6579,15 +6579,15 @@ function dateCellIndexsForDateCellScheduleDayCodes(sundayIndex, dayCodes) {
6579
6579
  /**
6580
6580
  * ArkType schema that validates a value is a valid {@link DateCellTiming}.
6581
6581
  */
6582
- const validDateCellTimingType = arktype.type('unknown').narrow((val, ctx) => isValidDateCellTiming(val) || ctx.mustBe('a valid DateCellTiming'));
6582
+ const validDateCellTimingType = dateCellTimingType.narrow((val, ctx) => (val != null && isValidDateCellTiming(val)) || ctx.mustBe('a valid DateCellTiming'));
6583
6583
  /**
6584
6584
  * ArkType schema that validates a value is a valid {@link DateCellRange} (non-negative indexes, `to >= i`).
6585
6585
  */
6586
- const validDateCellRangeType = arktype.type('unknown').narrow((val, ctx) => isValidDateCellRange(val) || ctx.mustBe('a valid DateCellRange'));
6586
+ const validDateCellRangeType = dateCellRangeType.narrow((val, ctx) => (val != null && isValidDateCellRange(val)) || ctx.mustBe('a valid DateCellRange'));
6587
6587
  /**
6588
6588
  * ArkType schema that validates a value is a sorted array of non-overlapping {@link DateCellRange} values.
6589
6589
  */
6590
- const validDateCellRangeSeriesType = arktype.type('unknown').narrow((val, ctx) => isValidDateCellRangeSeries(val) || ctx.mustBe('a valid DateCellRange series with items sorted in ascending order and no repeat indexes'));
6590
+ const validDateCellRangeSeriesType = arktype.type(dateCellRangeType.array()).narrow((val, ctx) => (val != null && isValidDateCellRangeSeries(val)) || ctx.mustBe('a valid DateCellRange series with items sorted in ascending order and no repeat indexes'));
6591
6591
 
6592
6592
  /**
6593
6593
  * Distinguishes between time-based calendar events and all-day/multi-day events.
package/index.esm.js CHANGED
@@ -2602,7 +2602,7 @@ function isKnownTimezone(input) {
2602
2602
  * const result = knownTimezoneType('America/Denver');
2603
2603
  * ```
2604
2604
  */
2605
- const knownTimezoneType = type('string > 0').narrow((val, ctx) => isKnownTimezone(val) || ctx.mustBe('a known timezone'));
2605
+ const knownTimezoneType = type('string > 0').narrow((val, ctx) => (val != null && isKnownTimezone(val)) || ctx.mustBe('a known timezone'));
2606
2606
 
2607
2607
  /**
2608
2608
  * Creates a {@link FitDateRangeToDayPeriodFunction} that collapses a multi-day date range into a single-day period within the given timezone.
@@ -6578,15 +6578,15 @@ function dateCellIndexsForDateCellScheduleDayCodes(sundayIndex, dayCodes) {
6578
6578
  /**
6579
6579
  * ArkType schema that validates a value is a valid {@link DateCellTiming}.
6580
6580
  */
6581
- const validDateCellTimingType = type('unknown').narrow((val, ctx) => isValidDateCellTiming(val) || ctx.mustBe('a valid DateCellTiming'));
6581
+ const validDateCellTimingType = dateCellTimingType.narrow((val, ctx) => (val != null && isValidDateCellTiming(val)) || ctx.mustBe('a valid DateCellTiming'));
6582
6582
  /**
6583
6583
  * ArkType schema that validates a value is a valid {@link DateCellRange} (non-negative indexes, `to >= i`).
6584
6584
  */
6585
- const validDateCellRangeType = type('unknown').narrow((val, ctx) => isValidDateCellRange(val) || ctx.mustBe('a valid DateCellRange'));
6585
+ const validDateCellRangeType = dateCellRangeType.narrow((val, ctx) => (val != null && isValidDateCellRange(val)) || ctx.mustBe('a valid DateCellRange'));
6586
6586
  /**
6587
6587
  * ArkType schema that validates a value is a sorted array of non-overlapping {@link DateCellRange} values.
6588
6588
  */
6589
- const validDateCellRangeSeriesType = type('unknown').narrow((val, ctx) => isValidDateCellRangeSeries(val) || ctx.mustBe('a valid DateCellRange series with items sorted in ascending order and no repeat indexes'));
6589
+ const validDateCellRangeSeriesType = type(dateCellRangeType.array()).narrow((val, ctx) => (val != null && isValidDateCellRangeSeries(val)) || ctx.mustBe('a valid DateCellRange series with items sorted in ascending order and no repeat indexes'));
6590
6590
 
6591
6591
  /**
6592
6592
  * Distinguishes between time-based calendar events and all-day/multi-day events.
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dereekb/date",
3
- "version": "13.1.0",
3
+ "version": "13.2.0",
4
4
  "peerDependencies": {
5
- "@dereekb/rxjs": "13.1.0",
6
- "@dereekb/util": "13.1.0",
5
+ "@dereekb/rxjs": "13.2.0",
6
+ "@dereekb/util": "13.2.0",
7
7
  "@vvo/tzdb": "^6.0.0",
8
8
  "arktype": "^2.2.0",
9
9
  "date-fns": "^4.0.0",
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "dependencies": {},
15
15
  "devDependencies": {
16
- "@dereekb/rxjs": "13.1.0"
16
+ "@dereekb/rxjs": "13.2.0"
17
17
  },
18
18
  "exports": {
19
19
  "./package.json": "./package.json",
@@ -1,12 +1,23 @@
1
1
  /**
2
2
  * ArkType schema that validates a value is a valid {@link DateCellTiming}.
3
3
  */
4
- export declare const validDateCellTimingType: import("arktype").BaseType<unknown, {}>;
4
+ export declare const validDateCellTimingType: import("arktype/internal/variants/object.ts").ObjectType<{
5
+ startsAt: Date;
6
+ duration: number;
7
+ end: Date;
8
+ timezone: string;
9
+ }, {}>;
5
10
  /**
6
11
  * ArkType schema that validates a value is a valid {@link DateCellRange} (non-negative indexes, `to >= i`).
7
12
  */
8
- export declare const validDateCellRangeType: import("arktype").BaseType<unknown, {}>;
13
+ export declare const validDateCellRangeType: import("arktype/internal/variants/object.ts").ObjectType<{
14
+ i: number;
15
+ to?: number | undefined;
16
+ }, {}>;
9
17
  /**
10
18
  * ArkType schema that validates a value is a sorted array of non-overlapping {@link DateCellRange} values.
11
19
  */
12
- export declare const validDateCellRangeSeriesType: import("arktype").BaseType<unknown, {}>;
20
+ export declare const validDateCellRangeSeriesType: import("arktype/internal/variants/array.ts").ArrayType<{
21
+ i: number;
22
+ to?: number | undefined;
23
+ }[], {}>;