class ObjectWriterImplZonedDateTime
        extends DateTimeCodec
        implements ObjectWriter {
    static final ObjectWriterImplZonedDateTime INSTANCE = new ObjectWriterImplZonedDateTime(null, null);

    private final Function function;

    public ObjectWriterImplZonedDateTime(String format, Locale locale) {
        this(format, locale, null);
    }

    public ObjectWriterImplZonedDateTime(String format, Locale locale, Function function) {
        super(format, locale);
        this.function = function;
    }

    @Override
    public void writeJSONB(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) {
        jsonWriter.writeZonedDateTime((ZonedDateTime) object);
    }

    @Override
    public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type fieldType, long features) {<FILL_FUNCTION_BODY>}
}

        if (object == null) {
            jsonWriter.writeNull();
            return;
        }

        ZonedDateTime zdt;
        if (function != null) {
            zdt = (ZonedDateTime) function.apply(object);
        } else {
            zdt = (ZonedDateTime) object;
        }

        JSONWriter.Context ctx = jsonWriter.context;

        if (formatUnixTime || (format == null && ctx.isDateFormatUnixTime())) {
            long millis = zdt.toInstant().toEpochMilli();
            jsonWriter.writeInt64(millis / 1000);
            return;
        }

        if (formatMillis || (format == null && ctx.isDateFormatMillis())) {
            jsonWriter.writeInt64(zdt
                    .toInstant()
                    .toEpochMilli());
            return;
        }

        final int year = zdt.getYear();
        if (year >= 0 && year <= 9999) {
            if (formatISO8601 || ctx.isDateFormatISO8601()) {
                jsonWriter.writeDateTimeISO8601(
                        year,
                        zdt.getMonthValue(),
                        zdt.getDayOfMonth(),
                        zdt.getHour(),
                        zdt.getMinute(),
                        zdt.getSecond(),
                        zdt.getNano() / 1000_000,
                        zdt.getOffset().getTotalSeconds(),
                        true
                );
                return;
            }

            if (yyyyMMddhhmmss19) {
                jsonWriter.writeDateTime19(
                        year,
                        zdt.getMonthValue(),
                        zdt.getDayOfMonth(),
                        zdt.getHour(),
                        zdt.getMinute(),
                        zdt.getSecond()
                );
                return;
            }

            if (yyyyMMddhhmmss14) {
                jsonWriter.writeDateTime14(
                        year,
                        zdt.getMonthValue(),
                        zdt.getDayOfMonth(),
                        zdt.getHour(),
                        zdt.getMinute(),
                        zdt.getSecond()
                );
                return;
            }
        }

        DateTimeFormatter formatter = this.getDateFormatter();
        if (formatter == null) {
            formatter = ctx.getDateFormatter();
        }

        if (formatter == null) {
            jsonWriter.writeZonedDateTime(zdt);
            return;
        }

        String str = formatter.format(zdt);
        jsonWriter.writeString(str);
    
<methods>public void <init>(java.lang.String) ,public void <init>(java.lang.String, java.util.Locale) ,public java.time.format.DateTimeFormatter getDateFormatter() ,public java.time.format.DateTimeFormatter getDateFormatter(java.util.Locale) <variables>java.time.format.DateTimeFormatter dateFormatter,public final non-sealed java.lang.String format,protected final non-sealed boolean formatHasDay,protected final non-sealed boolean formatHasHour,public final non-sealed boolean formatISO8601,public final non-sealed boolean formatMillis,public final non-sealed boolean formatUnixTime,public final non-sealed java.util.Locale locale,protected final non-sealed boolean useSimpleDateFormat,public final non-sealed boolean useSimpleFormatter,protected final non-sealed boolean yyyyMMdd10,protected final non-sealed boolean yyyyMMdd8,protected final non-sealed boolean yyyyMMddhhmm16,protected final non-sealed boolean yyyyMMddhhmmss14,protected final non-sealed boolean yyyyMMddhhmmss19