mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-05 21:57:45 +08:00
fix: fix error with setting default value for date type
This commit is contained in:
parent
ea33974ec5
commit
0a8fd44816
@ -4,6 +4,7 @@ import { Field } from '@formily/core';
|
||||
import { ISchema, Schema, observer, useField, useFieldSchema } from '@formily/react';
|
||||
import { uid } from '@formily/shared';
|
||||
import _ from 'lodash';
|
||||
import moment from 'moment';
|
||||
import React, { useContext, useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ACLCollectionFieldProvider } from '../../../acl/ACLProvider';
|
||||
@ -688,5 +689,9 @@ function isFileCollection(collection: Collection) {
|
||||
FormItem.FilterFormDesigner = FilterFormDesigner;
|
||||
|
||||
export function getFieldDefaultValue(fieldSchema: ISchema, collectionField: CollectionFieldOptions) {
|
||||
return fieldSchema?.default || collectionField?.defaultValue;
|
||||
const result = fieldSchema?.default || collectionField?.defaultValue;
|
||||
if (collectionField?.uiSchema?.['x-component'] === 'DatePicker' && result) {
|
||||
return moment(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user