当前端页面返回的值为如上时:
两种解决办法
1.
在列表单加入校验转换date的格式
(这个与新建页无关,新建页values.startDate的值正常用moment转string存入数据库)
2.
加入注解,提前在实体改变date的格式为想要的 'YYYY-MM-DD'格式
就可以正常显示啦
{
title: '请假开始日期',
dataIndex: 'startDate',
className: 'min-wid-m',
ellipsis: true,
customRender: text => {
if (text !== null) {
return moment(text).format('YYYY-MM-DD')
}
return ''
}
},
@Column(updatable = false)
@DateTimeFormat(pattern = SimpleDateUtil.DATETIME_FORMAT)
@JsonFormat(pattern = SimpleDateUtil.DATETIME_FORMAT, timezone = SimpleDateUtil.TIME_ZONE)
@Comment("创建时间")
private Date createTime;
@DateTimeFormat(pattern = SimpleDateUtil.DATETIME_FORMAT)
@JsonFormat(pattern = SimpleDateUtil.DATETIME_FORMAT, timezone = SimpleDateUtil.TIME_ZONE)
@Comment("修改时间")
private Date updateTime;