feat: 任务开始页面,相关逻辑补充
This commit is contained in:
+3
-4
@@ -10,8 +10,8 @@ import java.time.format.DateTimeFormatter;
|
||||
|
||||
public class LocalDateTimeSerializer extends StdSerializer<LocalDateTime> {
|
||||
|
||||
// 定义你希望使用的日期时间格式
|
||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");;
|
||||
// 修改为ISO 8601格式,末尾带Z,表示UTC时区
|
||||
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
|
||||
public LocalDateTimeSerializer() {
|
||||
super(LocalDateTime.class);
|
||||
@@ -22,9 +22,8 @@ public class LocalDateTimeSerializer extends StdSerializer<LocalDateTime> {
|
||||
if (value == null) {
|
||||
gen.writeNull();
|
||||
} else {
|
||||
// 格式化LocalDateTime为字符串
|
||||
// 这里假设LocalDateTime是UTC时间,直接格式化并加Z
|
||||
String formattedDate = value.format(formatter);
|
||||
// 将格式化后的字符串写入JSON流作为一个值
|
||||
gen.writeString(formattedDate);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user