el-date-picker 儲存報錯
阿新 • • 發佈:2021-06-28
前臺呼叫
<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日')