Skip to content

Commit

Permalink
Fix ZonedDateTimeSerializer
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubjungiewiczcodibly committed May 31, 2021
1 parent 441adb1 commit 48743c9
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import eu.chargetime.ocpp.model.Message;
import java.lang.reflect.Type;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -81,7 +82,7 @@ private class ZonedDateTimeSerializer implements JsonSerializer<ZonedDateTime> {
@Override
public JsonElement serialize(
ZonedDateTime zonedDateTime, Type type, JsonSerializationContext jsonSerializationContext) {
return new JsonPrimitive(zonedDateTime.toString());
return new JsonPrimitive(zonedDateTime.format(DateTimeFormatter.ISO_INSTANT));
}
}

Expand Down

0 comments on commit 48743c9

Please sign in to comment.