tw.yukina.notion.sdk.model.serializer.ZonedDateTimeSerializer Maven / Gradle / Ivy
package tw.yukina.notion.sdk.model.serializer;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatterBuilder;
public class ZonedDateTimeSerializer extends JsonSerializer {
@Override
public void serialize(ZonedDateTime value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
gen.writeString(value.format(new DateTimeFormatterBuilder().appendInstant(3).toFormatter()));
}
}