浏览代码

fix(patient-register): set patient_dob default value in Form's initialValues to avoid mismatch between UI display and getValues result

sw 1 月之前
父节点
当前提交
0b97cf0f8a
共有 1 个文件被更改,包括 10 次插入6 次删除
  1. 10 6
      src/pages/patient/components/register.form.tsx

+ 10 - 6
src/pages/patient/components/register.form.tsx

@@ -76,7 +76,15 @@ const BasicInfoForm: React.FC<BasicInfoFormProps> = ({ style, form }) => {
 
   const intl = useIntl();
   return (
-    <Form form={form} layout="vertical" style={style} className="px-2">
+    <Form
+      form={form}
+      layout="vertical"
+      style={style}
+      className="px-2"
+      initialValues={{
+        patient_dob: dayjs(),
+      }}
+    >
       <Form.Item
         label={
           <FormattedMessage
@@ -195,11 +203,7 @@ const BasicInfoForm: React.FC<BasicInfoFormProps> = ({ style, form }) => {
         validateTrigger={registerFormFields.patient_dob.trigger}
         rules={registerFormFields.patient_dob.validation}
       >
-        <DatePicker
-          format="YYYY-MM-DD"
-          defaultValue={dayjs()}
-          style={{ width: '100%' }}
-        />
+        <DatePicker format="YYYY-MM-DD" style={{ width: '100%' }} />
       </Form.Item>
       <Form.Item
         label={