Skip to content

Commit

Permalink
Merge pull request #145 from codibly/bugfix/fix-zoned-date-time-seria…
Browse files Browse the repository at this point in the history
…lizer

Fix ZonedDateTimeSerializer (ISO 8601)
  • Loading branch information
TVolden authored Jun 17, 2021
2 parents e82c9cf + 48743c9 commit 68410d5
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 68410d5

Please sign in to comment.