shelving 1.154.1 → 1.154.2
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 +1 -1
- package/schema/DateSchema.js +1 -1
- package/schema/DateTimeSchema.d.ts +1 -3
- package/schema/DateTimeSchema.js +3 -0
- package/schema/TimeSchema.d.ts +1 -1
- package/schema/TimeSchema.js +2 -2
- package/util/array.d.ts +1 -1
- package/util/array.js +1 -1
package/package.json
CHANGED
package/schema/DateSchema.js
CHANGED
|
@@ -7,7 +7,7 @@ export class DateSchema extends Schema {
|
|
|
7
7
|
min;
|
|
8
8
|
max;
|
|
9
9
|
input;
|
|
10
|
-
constructor({ min, max, value = "now", input = "
|
|
10
|
+
constructor({ min, max, value = "now", input = "date", ...options }) {
|
|
11
11
|
super({ title: "Date", value, ...options });
|
|
12
12
|
this.min = getDate(min);
|
|
13
13
|
this.max = getDate(max);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { DateSchema, type DateSchemaOptions } from "./DateSchema.js";
|
|
2
|
-
/** Allowed options for `DateSchema` */
|
|
3
|
-
export interface DateTimeSchemaOptions extends DateSchemaOptions {
|
|
4
|
-
}
|
|
5
2
|
/**
|
|
6
3
|
* Define a valid UTC date in ISO 8601 format, e.g. `2005-09-12T18:15:00.000Z`
|
|
7
4
|
* - The date includes the `Z` suffix to indicate UTC time, this ensures consistent transfer of the date between client and server.
|
|
@@ -9,6 +6,7 @@ export interface DateTimeSchemaOptions extends DateSchemaOptions {
|
|
|
9
6
|
* - If you wish to define an _abstract_ time without a timezone, e.g. a daily alarm, use `TimeSchema` instead.
|
|
10
7
|
*/
|
|
11
8
|
export declare class DateTimeSchema extends DateSchema {
|
|
9
|
+
constructor({ title, input, ...options }: DateSchemaOptions);
|
|
12
10
|
format(value: Date): string;
|
|
13
11
|
stringify(value: Date): string;
|
|
14
12
|
}
|
package/schema/DateTimeSchema.js
CHANGED
|
@@ -8,6 +8,9 @@ import { NULLABLE } from "./NullableSchema.js";
|
|
|
8
8
|
* - If you wish to define an _abstract_ time without a timezone, e.g. a daily alarm, use `TimeSchema` instead.
|
|
9
9
|
*/
|
|
10
10
|
export class DateTimeSchema extends DateSchema {
|
|
11
|
+
constructor({ title = "Time", input = "datetime-local", ...options }) {
|
|
12
|
+
super({ title, input, ...options });
|
|
13
|
+
}
|
|
11
14
|
format(value) {
|
|
12
15
|
return formatDateTime(value);
|
|
13
16
|
}
|
package/schema/TimeSchema.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare class TimeSchema extends DateSchema {
|
|
|
12
12
|
* - Note: `<input type="time">` elements expect `step=""` to be in _seconds_ so you need to multiply this by `1000`
|
|
13
13
|
*/
|
|
14
14
|
readonly step: number | undefined;
|
|
15
|
-
constructor({ title, step, ...options }: TimeSchemaOptions);
|
|
15
|
+
constructor({ title, input, step, ...options }: TimeSchemaOptions);
|
|
16
16
|
validate(unsafeValue?: unknown): string;
|
|
17
17
|
}
|
|
18
18
|
/** Valid time, e.g. `2005-09-12` (required because falsy values are invalid). */
|
package/schema/TimeSchema.js
CHANGED
|
@@ -11,8 +11,8 @@ export class TimeSchema extends DateSchema {
|
|
|
11
11
|
* - Note: `<input type="time">` elements expect `step=""` to be in _seconds_ so you need to multiply this by `1000`
|
|
12
12
|
*/
|
|
13
13
|
step;
|
|
14
|
-
constructor({ title = "Time", step, ...options }) {
|
|
15
|
-
super({ title, ...options });
|
|
14
|
+
constructor({ title = "Time", input = "time", step, ...options }) {
|
|
15
|
+
super({ title, input, ...options });
|
|
16
16
|
this.step = step;
|
|
17
17
|
}
|
|
18
18
|
validate(unsafeValue = this.value) {
|
package/util/array.d.ts
CHANGED
|
@@ -66,7 +66,7 @@ export declare function isArrayItem<T>(list: PossibleArray<T>, item: unknown): i
|
|
|
66
66
|
export declare function assertArrayItem<T>(arr: PossibleArray<T>, item: unknown, caller?: AnyCaller): asserts item is T;
|
|
67
67
|
/** Add multiple items to an array (immutably) and return a new array with those items (or the same array if no changes were made). */
|
|
68
68
|
export declare function withArrayItems<T>(list: PossibleArray<T>, ...add: T[]): ImmutableArray<T>;
|
|
69
|
-
/** Pick multiple items from an array (immutably) and return a new array
|
|
69
|
+
/** Pick multiple items from an array (immutably) and return a new array with those items (or the same array if no changes were made). */
|
|
70
70
|
export declare function pickArrayItems<T>(items: PossibleArray<T>, ...pick: T[]): ImmutableArray<T>;
|
|
71
71
|
/** Remove multiple items from an array (immutably) and return a new array without those items (or the same array if no changes were made). */
|
|
72
72
|
export declare function omitArrayItems<T>(items: PossibleArray<T>, ...omit: T[]): ImmutableArray<T>;
|
package/util/array.js
CHANGED
|
@@ -42,7 +42,7 @@ export function withArrayItems(list, ...add) {
|
|
|
42
42
|
function _doesNotInclude(value) {
|
|
43
43
|
return !this.includes(value);
|
|
44
44
|
}
|
|
45
|
-
/** Pick multiple items from an array (immutably) and return a new array
|
|
45
|
+
/** Pick multiple items from an array (immutably) and return a new array with those items (or the same array if no changes were made). */
|
|
46
46
|
export function pickArrayItems(items, ...pick) {
|
|
47
47
|
const arr = Array.from(pickItems(items, ...pick));
|
|
48
48
|
return isArray(items) && arr.length === items.length ? items : arr;
|