@innet/server 2.0.0-beta.21 → 2.0.0-beta.22
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,8 +1,7 @@
|
|
|
1
1
|
import { type HandlerPlugin } from 'innet';
|
|
2
2
|
import { type SchemaProps } from '../../../types';
|
|
3
3
|
import { type DateFormat } from '../../../utils';
|
|
4
|
-
export interface DateProps extends
|
|
5
|
-
const?: string;
|
|
4
|
+
export interface DateProps extends SchemaProps<DateFormat> {
|
|
6
5
|
max?: DateFormat;
|
|
7
6
|
min?: DateFormat;
|
|
8
7
|
}
|
|
@@ -15,7 +15,7 @@ import { useRule } from '../../../hooks/useRule/useRule.es6.js';
|
|
|
15
15
|
import { pipe } from '../../../utils/rules/pipe/pipe.es6.js';
|
|
16
16
|
|
|
17
17
|
const date = () => {
|
|
18
|
-
const { default: defaultValue, example, examples, max, min, values: values$1, ...props } = useProps() || {};
|
|
18
|
+
const { default: defaultValue, example, examples, max, min, value, values: values$1, ...props } = useProps() || {};
|
|
19
19
|
const normMin = dateFormat(min);
|
|
20
20
|
const normMax = dateFormat(max);
|
|
21
21
|
const normDefault = dateFormat(defaultValue);
|
|
@@ -28,6 +28,7 @@ const date = () => {
|
|
|
28
28
|
...props,
|
|
29
29
|
default: defaultValue === 'now' ? undefined : normDefault === null || normDefault === void 0 ? void 0 : normDefault.toISOString(),
|
|
30
30
|
example: normExample === null || normExample === void 0 ? void 0 : normExample.toISOString(),
|
|
31
|
+
value: value instanceof Date ? value.toISOString() : typeof value === 'number' ? new Date(value).toISOString() : value,
|
|
31
32
|
// @ts-expect-error: FIXME
|
|
32
33
|
examples: normExamples === null || normExamples === void 0 ? void 0 : normExamples.map(example => example.toISOString()),
|
|
33
34
|
values: stringValues,
|
|
@@ -19,7 +19,7 @@ var useRule = require('../../../hooks/useRule/useRule.js');
|
|
|
19
19
|
var pipe = require('../../../utils/rules/pipe/pipe.js');
|
|
20
20
|
|
|
21
21
|
const date = () => {
|
|
22
|
-
const { default: defaultValue, example, examples, max, min, values: values$1, ...props } = jsx.useProps() || {};
|
|
22
|
+
const { default: defaultValue, example, examples, max, min, value, values: values$1, ...props } = jsx.useProps() || {};
|
|
23
23
|
const normMin = dateFormat.dateFormat(min);
|
|
24
24
|
const normMax = dateFormat.dateFormat(max);
|
|
25
25
|
const normDefault = dateFormat.dateFormat(defaultValue);
|
|
@@ -32,6 +32,7 @@ const date = () => {
|
|
|
32
32
|
...props,
|
|
33
33
|
default: defaultValue === 'now' ? undefined : normDefault === null || normDefault === void 0 ? void 0 : normDefault.toISOString(),
|
|
34
34
|
example: normExample === null || normExample === void 0 ? void 0 : normExample.toISOString(),
|
|
35
|
+
value: value instanceof Date ? value.toISOString() : typeof value === 'number' ? new Date(value).toISOString() : value,
|
|
35
36
|
// @ts-expect-error: FIXME
|
|
36
37
|
examples: normExamples === null || normExamples === void 0 ? void 0 : normExamples.map(example => example.toISOString()),
|
|
37
38
|
values: stringValues,
|