소스 검색

fix (1.17.1): 修复出生日期可以选择未来日期的问题

- 在 DatePicker 组件中添加 disabledDate 属性,禁用大于今天的日期
- 使用 dayjs().endOf('day') 确保包括今天整天,避免边界问题
- 提升数据完整性,防止输入无效的出生日期

改动文件:
- src/pages/patient/components/register.form.tsx
- CHANGELOG.md
- package.json
dengdx 3 주 전
부모
커밋
ffe5105911
3개의 변경된 파일27개의 추가작업 그리고 2개의 파일을 삭제
  1. 21 0
      CHANGELOG.md
  2. 1 1
      package.json
  3. 5 1
      src/pages/patient/components/register.form.tsx

+ 21 - 0
CHANGELOG.md

@@ -2,6 +2,27 @@
 
 本项目的所有重要变更都将记录在此文件中。
 
+## [1.17.1] - 2025-12-20 16:25
+
+### 修复 (Fixed)
+- **出生日期选择未来日期问题修复** ([src/pages/patient/components/register.form.tsx](src/pages/patient/components/register.form.tsx))
+  - 修复患者注册表单中出生日期可以选择未来日期的问题
+  - 在 DatePicker 组件中添加 disabledDate 属性,禁用大于今天的日期
+  - 使用 dayjs().endOf('day') 确保包括今天整天,避免边界问题
+  - 提升数据完整性,防止输入无效的出生日期
+
+**核心改进:**
+- 用户体验优化:日期选择器现在自动禁用未来日期,避免用户输入错误
+- 数据验证增强:通过 UI 层面限制,配合表单验证确保数据正确性
+- 代码简洁:利用 Ant Design DatePicker 的 disabledDate 属性实现,无需额外验证逻辑
+
+**改动文件:**
+- src/pages/patient/components/register.form.tsx
+- CHANGELOG.md
+- package.json (版本更新: 1.17.0 -> 1.17.1)
+
+---
+
 ## [1.17.0] - 2025-12-20 16:00
 
 ### 新增 (Added)

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "zsis",
-  "version": "1.17.0",
+  "version": "1.17.1",
   "private": true,
   "description": "医学成像系统",
   "main": "main.js",

+ 5 - 1
src/pages/patient/components/register.form.tsx

@@ -275,7 +275,11 @@ const BasicInfoForm: React.FC<BasicInfoFormProps> = ({
         validateTrigger={registerFormFields.patient_dob.trigger}
         rules={registerFormFields.patient_dob.validation}
       >
-        <DatePicker format="YYYY-MM-DD" style={{ width: '100%' }} />
+        <DatePicker
+          format="YYYY-MM-DD"
+          style={{ width: '100%' }}
+          disabledDate={(current) => current && current > dayjs().endOf('day')}
+        />
       </Form.Item>
       <Form.Item
         label={