@dereekb/date 13.1.0 → 13.2.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/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@dereekb/date",
3
- "version": "13.1.0",
3
+ "version": "13.2.1",
4
4
  "peerDependencies": {
5
- "@dereekb/rxjs": "13.1.0",
6
- "@dereekb/util": "13.1.0",
5
+ "@dereekb/rxjs": "13.2.1",
6
+ "@dereekb/util": "13.2.1",
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.1"
17
17
  },
18
18
  "exports": {
19
19
  "./package.json": "./package.json",
@@ -20,14 +20,6 @@ export declare enum CalendarDateType {
20
20
  export interface CalendarDate extends DateDurationSpan {
21
21
  type: CalendarDateType;
22
22
  }
23
- /**
24
- * ArkType schema for {@link CalendarDate}.
25
- */
26
- export declare const calendarDateType: import("arktype/internal/variants/object.ts").ObjectType<{
27
- startsAt: Date;
28
- duration: number;
29
- type: CalendarDateType;
30
- }, {}>;
31
23
  /**
32
24
  * Configuration for creating calendar dates with timezone handling.
33
25
  */
@@ -41,12 +41,6 @@ export interface DateCellIndexDatePair extends Readonly<IndexRef> {
41
41
  export interface DateCell extends IndexRef {
42
42
  i: DateCellIndex;
43
43
  }
44
- /**
45
- * ArkType schema for {@link DateCell}.
46
- */
47
- export declare const dateCellType: import("arktype/internal/variants/object.ts").ObjectType<{
48
- i: number;
49
- }, {}>;
50
44
  /**
51
45
  * Normalizes a number or {@link DateCell} to a DateCell object.
52
46
  *
@@ -133,15 +127,6 @@ export interface DateCellTimingDateRange extends DateRange, TimezoneStringRef {
133
127
  * A DateCellTimingDateRange, but the start time is the startsAt time for the first event.
134
128
  */
135
129
  export type DateCellTimingEventRange = DateCellTimingDateRange;
136
- /**
137
- * ArkType schema for {@link DateCellTiming}.
138
- */
139
- export declare const dateCellTimingType: import("arktype/internal/variants/object.ts").ObjectType<{
140
- startsAt: Date;
141
- duration: number;
142
- end: Date;
143
- timezone: string;
144
- }, {}>;
145
130
  /**
146
131
  * Reference to a DateCellTiming
147
132
  */
@@ -12,13 +12,6 @@ export interface DateCellRange extends DateCell {
12
12
  */
13
13
  to?: DateCellIndex;
14
14
  }
15
- /**
16
- * ArkType schema for {@link DateCellRange}.
17
- */
18
- export declare const dateCellRangeType: import("arktype/internal/variants/object.ts").ObjectType<{
19
- i: number;
20
- to?: number | undefined;
21
- }, {}>;
22
15
  /**
23
16
  * Returns true if the input is a DateCellRange.
24
17
  *
@@ -229,14 +229,6 @@ export declare function isDateCellSchedule(input: object): input is DateCellSche
229
229
  * @returns whether both schedules are equivalent
230
230
  */
231
231
  export declare function isSameDateCellSchedule(a: Maybe<DateCellSchedule>, b: Maybe<DateCellSchedule>): boolean;
232
- /**
233
- * ArkType schema for {@link DateCellSchedule}.
234
- */
235
- export declare const dateCellScheduleType: import("arktype/internal/variants/object.ts").ObjectType<{
236
- w: string;
237
- d?: number[] | undefined;
238
- ex?: number[] | undefined;
239
- }, {}>;
240
232
  /**
241
233
  * A DateCellSchedule combined with a DateRange and timezone, bounding the schedule to a specific date window.
242
234
  */
@@ -1,12 +1 @@
1
- /**
2
- * ArkType schema that validates a value is a valid {@link DateCellTiming}.
3
- */
4
- export declare const validDateCellTimingType: import("arktype").BaseType<unknown, {}>;
5
- /**
6
- * ArkType schema that validates a value is a valid {@link DateCellRange} (non-negative indexes, `to >= i`).
7
- */
8
- export declare const validDateCellRangeType: import("arktype").BaseType<unknown, {}>;
9
- /**
10
- * ArkType schema that validates a value is a sorted array of non-overlapping {@link DateCellRange} values.
11
- */
12
- export declare const validDateCellRangeSeriesType: import("arktype").BaseType<unknown, {}>;
1
+ export { validDateCellTimingType, validDateCellRangeType, validDateCellRangeSeriesType } from './date.model';
@@ -9,13 +9,6 @@ export interface DateDurationSpan {
9
9
  startsAt: Date;
10
10
  duration: Minutes;
11
11
  }
12
- /**
13
- * ArkType schema for {@link DateDurationSpan}.
14
- */
15
- export declare const dateDurationSpanType: import("arktype/internal/variants/object.ts").ObjectType<{
16
- startsAt: Date;
17
- duration: number;
18
- }, {}>;
19
12
  /**
20
13
  * Computes the end date for a duration span by adding the duration to the start time.
21
14
  *
@@ -0,0 +1,151 @@
1
+ import { DateRangeType } from './date.range';
2
+ import { CalendarDateType } from './date.calendar';
3
+ /**
4
+ * ArkType DTO schema that validates a string is a recognized IANA timezone.
5
+ *
6
+ * Delegates to {@link isKnownTimezone} for the actual check.
7
+ *
8
+ * Intended for validating and parsing DTO/JSON data where timezones arrive as strings.
9
+ *
10
+ * @example
11
+ * ```ts
12
+ * const result = knownTimezoneType('America/Denver');
13
+ * ```
14
+ */
15
+ export declare const knownTimezoneType: import("arktype/internal/variants/string.ts").StringType<string, {}>;
16
+ /**
17
+ * ArkType DTO schema for {@link DateDurationSpan}.
18
+ *
19
+ * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
20
+ * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
21
+ * into the corresponding runtime types.
22
+ */
23
+ export declare const dateDurationSpanType: import("arktype/internal/variants/object.ts").ObjectType<{
24
+ startsAt: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
25
+ duration: number;
26
+ }, {}>;
27
+ /**
28
+ * ArkType DTO schema for {@link DateRange}.
29
+ *
30
+ * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
31
+ * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
32
+ * into the corresponding runtime types.
33
+ */
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>;
37
+ }, {}>;
38
+ /**
39
+ * ArkType DTO schema for {@link DateRangeParams}.
40
+ *
41
+ * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
42
+ * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
43
+ * into the corresponding runtime types.
44
+ */
45
+ export declare const dateRangeParamsType: import("arktype/internal/variants/object.ts").ObjectType<{
46
+ type: DateRangeType;
47
+ date: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
48
+ distance?: number | undefined;
49
+ }, {}>;
50
+ /**
51
+ * ArkType DTO schema for {@link DateCell}.
52
+ *
53
+ * Validates a cell index from JSON/DTO input.
54
+ * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
55
+ * into the corresponding runtime types.
56
+ */
57
+ export declare const dateCellType: import("arktype/internal/variants/object.ts").ObjectType<{
58
+ i: number;
59
+ }, {}>;
60
+ /**
61
+ * ArkType DTO schema for {@link DateCellRange}.
62
+ *
63
+ * Validates cell range indexes from JSON/DTO input.
64
+ * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
65
+ * into the corresponding runtime types.
66
+ */
67
+ export declare const dateCellRangeType: import("arktype/internal/variants/object.ts").ObjectType<{
68
+ i: number;
69
+ to?: number | undefined;
70
+ }, {}>;
71
+ /**
72
+ * ArkType DTO schema for {@link DateCellTiming}.
73
+ *
74
+ * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
75
+ * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
76
+ * into the corresponding runtime types.
77
+ */
78
+ export declare const dateCellTimingType: import("arktype/internal/variants/object.ts").ObjectType<{
79
+ startsAt: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
80
+ duration: number;
81
+ end: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
82
+ timezone: string;
83
+ }, {}>;
84
+ /**
85
+ * ArkType DTO schema for {@link CalendarDate}.
86
+ *
87
+ * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
88
+ * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
89
+ * into the corresponding runtime types.
90
+ */
91
+ export declare const calendarDateType: import("arktype/internal/variants/object.ts").ObjectType<{
92
+ startsAt: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
93
+ duration: number;
94
+ type: CalendarDateType;
95
+ }, {}>;
96
+ /**
97
+ * ArkType DTO schema for {@link DateCellSchedule}.
98
+ *
99
+ * Validates schedule data from JSON/DTO input.
100
+ * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
101
+ * into the corresponding runtime types.
102
+ */
103
+ export declare const dateCellScheduleType: import("arktype/internal/variants/object.ts").ObjectType<{
104
+ w: string;
105
+ d?: number[] | undefined;
106
+ ex?: number[] | undefined;
107
+ }, {}>;
108
+ /**
109
+ * ArkType DTO schema for {@link ModelRecurrenceInfo}.
110
+ *
111
+ * Parses date strings from JSON/DTO input into Date objects using `string.date.parse`.
112
+ * Use this schema when validating and converting serialized data (e.g., API responses, JSON payloads)
113
+ * into the corresponding runtime types.
114
+ */
115
+ export declare const modelRecurrenceInfoType: import("arktype/internal/variants/object.ts").ObjectType<{
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>;
119
+ timezone?: string | undefined;
120
+ forever?: boolean | undefined;
121
+ }, {}>;
122
+ /**
123
+ * ArkType DTO schema that validates a value is a valid {@link DateCellTiming}.
124
+ *
125
+ * Parses date strings from JSON/DTO input into Date objects, then validates the resulting timing
126
+ * using {@link isValidDateCellTiming}.
127
+ */
128
+ export declare const validDateCellTimingType: import("arktype/internal/variants/object.ts").ObjectType<{
129
+ startsAt: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
130
+ duration: number;
131
+ end: (In: string) => import("arktype/internal/attributes.ts").To<Date>;
132
+ timezone: string;
133
+ }, {}>;
134
+ /**
135
+ * ArkType DTO schema that validates a value is a valid {@link DateCellRange} (non-negative indexes, `to >= i`).
136
+ *
137
+ * Validates cell range data from JSON/DTO input.
138
+ */
139
+ export declare const validDateCellRangeType: import("arktype/internal/variants/object.ts").ObjectType<{
140
+ i: number;
141
+ to?: number | undefined;
142
+ }, {}>;
143
+ /**
144
+ * ArkType DTO schema that validates a value is a sorted array of non-overlapping {@link DateCellRange} values.
145
+ *
146
+ * Validates cell range series data from JSON/DTO input.
147
+ */
148
+ export declare const validDateCellRangeSeriesType: import("arktype/internal/variants/array.ts").ArrayType<{
149
+ i: number;
150
+ to?: number | undefined;
151
+ }[], {}>;
@@ -37,13 +37,6 @@ export declare const sortDateRangeStartAscendingCompareFunction: <T extends Date
37
37
  export interface DateRange extends DateRangeStart {
38
38
  end: Date;
39
39
  }
40
- /**
41
- * ArkType schema for {@link DateRange}.
42
- */
43
- export declare const dateRangeType: import("arktype/internal/variants/object.ts").ObjectType<{
44
- start: Date;
45
- end: Date;
46
- }, {}>;
47
40
  /**
48
41
  * Counts the total number of calendar days spanned by the range, inclusive of both endpoints.
49
42
  * Always returns at least 1, even for same-day ranges.
@@ -215,14 +208,6 @@ export interface DateRangeParams {
215
208
  date: Date;
216
209
  distance?: number;
217
210
  }
218
- /**
219
- * ArkType schema for {@link DateRangeParams}.
220
- */
221
- export declare const dateRangeParamsType: import("arktype/internal/variants/object.ts").ObjectType<{
222
- type: DateRangeType;
223
- date: Date;
224
- distance?: number | undefined;
225
- }, {}>;
226
211
  export interface DateRangeTypedInput {
227
212
  type: DateRangeType;
228
213
  date?: Maybe<Date>;
@@ -9,6 +9,7 @@ export * from './date.cell.week';
9
9
  export * from './date.calendar';
10
10
  export * from './date.duration';
11
11
  export * from './date.format';
12
+ export * from './date.model';
12
13
  export * from './date.hashset';
13
14
  export * from './date.logical';
14
15
  export * from './date.range';
@@ -30,16 +30,6 @@ export interface ModelRecurrenceInfo extends DateRange {
30
30
  /** True if the recurrence has no end. */
31
31
  forever?: boolean;
32
32
  }
33
- /**
34
- * ArkType schema for {@link ModelRecurrenceInfo}.
35
- */
36
- export declare const modelRecurrenceInfoType: import("arktype/internal/variants/object.ts").ObjectType<{
37
- rrule: string;
38
- start: Date;
39
- end: Date;
40
- timezone?: string | undefined;
41
- forever?: boolean | undefined;
42
- }, {}>;
43
33
  /**
44
34
  * Input used to create or update recurrence on a model, before it is
45
35
  * expanded into a full {@link ModelRecurrenceInfo}.
@@ -1,11 +1 @@
1
- /**
2
- * ArkType schema that validates a string is a recognized IANA timezone.
3
- *
4
- * Delegates to {@link isKnownTimezone} for the actual check.
5
- *
6
- * @example
7
- * ```ts
8
- * const result = knownTimezoneType('America/Denver');
9
- * ```
10
- */
11
- export declare const knownTimezoneType: import("arktype/internal/variants/string.ts").StringType<string, {}>;
1
+ export { knownTimezoneType } from '../date/date.model';