el-date-picker 保存报错

前台调用
<el-date-picker v-model="dataForm.hdJssj" type="datetime" placeholder="请选择活动结束时间" ></el-date-picker>

后台数据库
字段:hd_jssj 类型: datetime

PO类:
引用 import java.time.LocalDateTime;

使用声明 private LocalDateTime hdJssj;

错误:

JSON parse error: 
Cannot deserialize value of type `java.time.LocalDateTime` from String "2021-06-29T16:00:00.000Z": 
Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2021-06-29T16:00:00.000Z' could not be parsed at index 10; 
nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: 
Cannot deserialize value of type `java.time.LocalDateTime` from String "2021-06-29T16:00:00.000Z":
 Failed to deserialize java.time.LocalDateTime: (java.time.format.DateTimeParseException) Text '2021-06-29T16:00:00.000Z' could not be parsed at index 10 
at [Source: (PushbackInputStream); line: 1, column: 71] (through reference chain: com.brightfuture.bfcloud.ceping.entity.CepingHdglb["hdJssj"])

解决办法:
<el-date-picker v-model="dataForm.hdJssj" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>

其他备用:
value-format="timestamp" format="yyyy 年 M 月 d 日"

$moment(value).format('YYYY年MM月DD日')

posted @ 2021-06-28 20:33  寒冷的雨呢  阅读(751)  评论(0编辑  收藏  举报