antd时间选择器数据格式化

前端页面使用了antd的时间选择器,然后传时间的时候一直报错:

Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type java.util.Date from String “2020-08-04T02:04:17.727Z”: expected format "yyyy-MM-dd HH:mm:ss"

后台实体类的时间格式是
在这里插入图片描述
然后数据库里面的需求其实只用到年月日就可以了,不用到时分秒,
所以后台把时间格式改为
在这里插入图片描述
前端的时间选择器的控件中,有个属性是格式化时间值的
在这里插入图片描述
然后我在组件中也加了这个属性
在这里插入图片描述
前后端的数据格式要一致,设置完之后就可以成功的提交时间了

猜你喜欢

转载自blog.csdn.net/weixin_39040527/article/details/107780843
今日推荐