ant-design / ant-design/pro-components

🐛[BUG] EditableProTable valueType设置为date类型,输出的日期格式变成了"YYYY-MM-DD hh:mm:ss",这与之前的格式"YYYY-MM-DD"不一致

Open
#8,875 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

### 🐛 bug 描述

将EditableProTable valueType设置为date类型,输出的日期格式变成了"YYYY-MM-DD hh:mm:ss",这与之前组件输出的格式"YYYY-MM-DD"不一致,导致需要额外处理日期类型。并且是突然出现的问题,业务中正常使用了几个月,最近几天突然频繁接到反馈问题,因为我们做了强类型控制,变更了格式导致了错误的产生。目前只能通过输出数据强转为需要的格式来解决,但是如何避免此类问题呢?

### 📷 复现步骤

将EditableProTable的column中添加一个valueType为date类型的组件,onSave的时候打印输出日志

### 🏞 期望结果

valueType为date类型,输出的结果为YYYY-MM-DD,或者文档中给出详细说明,输出格式,这样开发者在使用的过程中可以收到明确的信息

### 💻 复现代码

{
title: 下次沟通时间,
dataIndex: 'nextCommunicationTime',
width: 150,
valueType: 'date',
align: 'center',
},
![image](https://github.com/user-attachments/assets/15182d96-d707-40ec-a2e8-99ed1827b87a)

### © 版本信息

- ProComponents 版本: [2.4.14]
- umi 版本 [3.4.25]
- 浏览器环境 [Chrome 131.0.6778.70(正式版本) (x86_64)]
- 开发环境 [mac OS]

### 🚑 其他信息

Contributor guide

Open the contributing guide

Research direction

Start with an EditableProTable column using valueType: 'date' and inspect the value received by onSave. Reproduce the difference between the documented or expected YYYY-MM-DD output and the observed YYYY-MM-DD hh:mm:ss format using the versions listed. Done means the date value consistently follows the expected format or the documentation clearly specifies the output format.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.