bson/src/main/org/bson/codecs/jsr310/LocalDateCodec.java
@Override
    public void encode(final BsonWriter writer, final LocalDate value, final EncoderContext encoderContext) {
        try {
            writer.writeDateTime(value.atStartOfDay(ZoneOffset.UTC).toInstant().toEpochMilli());
        } catch (ArithmeticException e) {
            throw new CodecConfigurationException(format("Unsupported LocalDate '%s' could not be converted to milliseconds: %s",
                    value, e.getMessage()), e);
        }
    }
@Override
    public void encode(final BsonWriter writer, final LocalDate value, final EncoderContext encoderContext) {
        try {
            writer.writeDateTime(value.atStartOfDay(ZoneOffset.UTC).toInstant().toEpochMilli());
        } catch (ArithmeticException e) {
            throw new CodecConfigurationException(format("Unsupported LocalDate '%s' could not be converted to milliseconds: %s",
                    value, e.getMessage()), e);
        }
    }
{@inheritDoc}
<p>Converts the {@code LocalDate} to {@link ZoneOffset#UTC} via {@link LocalDate#atStartOfDay(ZoneId)}.</p>
@throws CodecConfigurationException if the LocalDate cannot be converted to a valid Bson DateTime.