@SuppressWarnings("JavaUtilDate")
  protected LocalDate convertDateValue(Object value) {
    if (value instanceof Number) {
      int days = ((Number) value).intValue();
      return DateTimeUtil.dateFromDays(days);
    } else if (value instanceof String) {
      return LocalDate.parse((String) value);
    } else if (value instanceof LocalDate) {
      return (LocalDate) value;
    } else if (value instanceof Date) {
      int days = (int) (((Date) value).getTime() / 1000 / 60 / 60 / 24);
      return DateTimeUtil.dateFromDays(days);
    }
    throw new RuntimeException("Cannot convert date: " + value);
  }
@Test
  public void testDateConversion() {
    Table table = mock(Table.class);
    when(table.schema()).thenReturn(SIMPLE_SCHEMA);
    RecordConverter converter = new RecordConverter(table, config);

    LocalDate expected = LocalDate.of(2023, 11, 15);

    List<Object> inputList =
        ImmutableList.of(
            "2023-11-15",
            expected.toEpochDay(),
            expected,
            new Date(Duration.ofDays(expected.toEpochDay()).toMillis()));

    inputList.forEach(
        input -> {
          Temporal ts = converter.convertDateValue(input);
          assertThat(ts).isEqualTo(expected);
        });
  }