Skip to content

Commit

Permalink
fix: correct time deserialization format annotation placement
Browse files Browse the repository at this point in the history
  • Loading branch information
khakers committed Sep 19, 2023
1 parent 7dded40 commit a9e91a3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
public final class Message implements Comparable<Message> {
private final String id;

@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateFormatters.PYTHON_STR_ISO_OFFSET_DATE_TIME_STRING, timezone = "UTC", locale = "en")
private final Instant creationTime;
private final String content;
private final List<Attachment> attachments;
Expand Down Expand Up @@ -49,6 +48,7 @@ public final class Message implements Comparable<Message> {
public Message(
@JsonProperty("message_id") String id,
@JsonProperty("timestamp")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateFormatters.PYTHON_STR_ISO_OFFSET_DATE_TIME_STRING, timezone = "UTC")
Instant creationTime,
@JsonProperty("content") String content,
@JsonProperty("attachments") List<Attachment> attachments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class DateFormatters {
.withChronology(IsoChronology.INSTANCE)
.withZone(ZoneId.of("UTC"));

public static final String PYTHON_STR_ISO_OFFSET_DATE_TIME_STRING = "yyyy-MM-dd HH:mm[:ss[.n]][XXX]";
public static final String PYTHON_STR_ISO_OFFSET_DATE_TIME_STRING = "uuuu-MM-dd HH:mm[:ss[.n]][XXX]";
public static final DateTimeFormatter SIMPLE_TIME_FORMAT = new DateTimeFormatterBuilder()
.appendPattern("HH:mm a")
.toFormatter()
Expand Down

0 comments on commit a9e91a3

Please sign in to comment.