@dereekb/date 13.2.1 → 13.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/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dereekb/date",
3
- "version": "13.2.1",
3
+ "version": "13.3.0",
4
4
  "peerDependencies": {
5
- "@dereekb/rxjs": "13.2.1",
6
- "@dereekb/util": "13.2.1",
5
+ "@dereekb/rxjs": "13.3.0",
6
+ "@dereekb/util": "13.3.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.2.1"
16
+ "@dereekb/rxjs": "13.3.0"
17
17
  },
18
18
  "exports": {
19
19
  "./package.json": "./package.json",
@@ -1,4 +1,4 @@
1
- import { type Maybe, type SortCompareFunction, type RequiredOnKeys, type ArrayOrValue, type UniqueModel, type IndexNumber, type FactoryWithRequiredInput, type DateRelativeState } from '@dereekb/util';
1
+ import { type Maybe, type SortCompareFunction, type ArrayOrValue, type UniqueModel, type IndexNumber, type FactoryWithRequiredInput, type DateRelativeState } from '@dereekb/util';
2
2
  import { type DateCell, type DateOrDateCellIndex, type DateCellIndex } from './date.cell';
3
3
  import { type DateRange } from './date.range';
4
4
  /**
@@ -10,7 +10,7 @@ export interface DateCellRange extends DateCell {
10
10
  *
11
11
  * If not provided, assumes this has no range and starts/ends at the same index, i.
12
12
  */
13
- to?: DateCellIndex;
13
+ to?: Maybe<DateCellIndex>;
14
14
  }
15
15
  /**
16
16
  * Returns true if the input is a DateCellRange.
@@ -101,7 +101,7 @@ export type DateOrDateRangeOrDateCellIndexOrDateCellRange = DateRange | DateOrDa
101
101
  * @param i - starting cell index
102
102
  * @param to - ending cell index (inclusive); defaults to `i`
103
103
  */
104
- export declare function dateCellRange(i: number, to?: number): DateCellRangeWithRange;
104
+ export declare function dateCellRange(i: number, to?: Maybe<number>): DateCellRangeWithRange;
105
105
  /**
106
106
  * Creates a single-cell {@link DateCellRangeWithRange} where both `i` and `to` equal the given index.
107
107
  *
@@ -159,7 +159,9 @@ export declare function sortDateCellRanges<T extends DateCellRange>(input: T[]):
159
159
  /**
160
160
  * DateCellRange that is known to have a to value.
161
161
  */
162
- export type DateCellRangeWithRange = RequiredOnKeys<DateCellRange, 'to'>;
162
+ export type DateCellRangeWithRange = Omit<DateCellRange, 'to'> & {
163
+ to: DateCellIndex;
164
+ };
163
165
  /**
164
166
  * Merges an array of {@link DateCell} or {@link DateCellRange} values into the smallest set of
165
167
  * contiguous {@link DateCellRangeWithRange} values. Adjacent or overlapping ranges are combined.
@@ -16,35 +16,35 @@ export declare const knownTimezoneType: import("arktype/internal/variants/string
16
16
  /**
17
17
  * ArkType DTO schema for {@link DateDurationSpan}.
18
18
  *
19
- * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
19
+ * Accepts both Date objects and date strings (parsed via `string.date.parse`).
20
20
  * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
21
- * into the corresponding runtime types.
21
+ * or runtime Date objects into the corresponding runtime types.
22
22
  */
23
23
  export declare const dateDurationSpanType: import("arktype/internal/variants/object.ts").ObjectType<{
24
- startsAt: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
24
+ startsAt: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
25
25
  duration: number;
26
26
  }, {}>;
27
27
  /**
28
28
  * ArkType DTO schema for {@link DateRange}.
29
29
  *
30
- * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
30
+ * Accepts both Date objects and date strings (parsed via `string.date.parse`).
31
31
  * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
32
- * into the corresponding runtime types.
32
+ * or runtime Date objects into the corresponding runtime types.
33
33
  */
34
34
  export declare const dateRangeType: import("arktype/internal/variants/object.ts").ObjectType<{
35
- start: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
36
- end: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
35
+ start: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
36
+ end: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
37
37
  }, {}>;
38
38
  /**
39
39
  * ArkType DTO schema for {@link DateRangeParams}.
40
40
  *
41
- * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
41
+ * Accepts both Date objects and date strings (parsed via `string.date.parse`).
42
42
  * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
43
- * into the corresponding runtime types.
43
+ * or runtime Date objects into the corresponding runtime types.
44
44
  */
45
45
  export declare const dateRangeParamsType: import("arktype/internal/variants/object.ts").ObjectType<{
46
46
  type: DateRangeType;
47
- date: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
47
+ date: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
48
48
  distance?: number | undefined;
49
49
  }, {}>;
50
50
  /**
@@ -71,25 +71,25 @@ export declare const dateCellRangeType: import("arktype/internal/variants/object
71
71
  /**
72
72
  * ArkType DTO schema for {@link DateCellTiming}.
73
73
  *
74
- * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
74
+ * Accepts both Date objects and date strings (parsed via `string.date.parse`).
75
75
  * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
76
- * into the corresponding runtime types.
76
+ * or runtime Date objects into the corresponding runtime types.
77
77
  */
78
78
  export declare const dateCellTimingType: import("arktype/internal/variants/object.ts").ObjectType<{
79
- startsAt: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
79
+ startsAt: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
80
80
  duration: number;
81
- end: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
81
+ end: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
82
82
  timezone: string;
83
83
  }, {}>;
84
84
  /**
85
85
  * ArkType DTO schema for {@link CalendarDate}.
86
86
  *
87
- * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
87
+ * Accepts both Date objects and date strings (parsed via `string.date.parse`).
88
88
  * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
89
- * into the corresponding runtime types.
89
+ * or runtime Date objects into the corresponding runtime types.
90
90
  */
91
91
  export declare const calendarDateType: import("arktype/internal/variants/object.ts").ObjectType<{
92
- startsAt: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
92
+ startsAt: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
93
93
  duration: number;
94
94
  type: CalendarDateType;
95
95
  }, {}>;
@@ -108,27 +108,27 @@ export declare const dateCellScheduleType: import("arktype/internal/variants/obj
108
108
  /**
109
109
  * ArkType DTO schema for {@link ModelRecurrenceInfo}.
110
110
  *
111
- * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
111
+ * Accepts both Date objects and date strings (parsed via `string.date.parse`).
112
112
  * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
113
- * into the corresponding runtime types.
113
+ * or runtime Date objects into the corresponding runtime types.
114
114
  */
115
115
  export declare const modelRecurrenceInfoType: import("arktype/internal/variants/object.ts").ObjectType<{
116
116
  rrule: string;
117
- start: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
118
- end: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
117
+ start: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
118
+ end: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
119
119
  timezone?: string | undefined;
120
120
  forever?: boolean | undefined;
121
121
  }, {}>;
122
122
  /**
123
123
  * ArkType DTO schema that validates a value is a valid {@link DateCellTiming}.
124
124
  *
125
- * Parses date strings from JSON/DTO input into Date objects, then validates the resulting timing
125
+ * Accepts both Date objects and date strings (parsed via `string.date.parse`), then validates the resulting timing
126
126
  * using {@link isValidDateCellTiming}.
127
127
  */
128
128
  export declare const validDateCellTimingType: import("arktype/internal/variants/object.ts").ObjectType<{
129
- startsAt: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
129
+ startsAt: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
130
130
  duration: number;
131
- end: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
131
+ end: Date | ((In: string) => import("arktype/internal/attributes.ts").To<Date>);
132
132
  timezone: string;
133
133
  }, {}>;
134
134
  /**