title: jooq Converter: from java.sql.Date to java.time.LocalDate
body: <p>I have tried to write a <code>Converter&lt;java.sql.Date, java.time.LocalDate&gt;</code> but I can't get it to work with all time zone settings.</p>
  
  <p>The idea:</p>
  
  <ul>
  <li>if the  client code has a <code>LocalDate</code>, say 20-Aug-2014, and saves it to the DB, it should appear as 20-Aug-2014 in the DB, no matter what the client time zone is.</li>
  <li>if the DB contains a date of 20-Aug-2014, the client should receive a LocalDate of 20-Aug-2014, no matter what the client time zone is.</li>
  </ul>
  
  <p>My test:</p>
  
  <pre><code>@Test public void dateConverter() {
    for (int offset = -12; offset &lt;= 12; offset++) {
      TimeZone localTz = TimeZone.getTimeZone(ZoneOffset.ofHours(offset));
      TimeZone.setDefault(localTz);
      LocalDate ld = LocalDate.now();
  
      sql.insertInto(DATE_TEST).set(new DateTestRecord(ld)).execute();
      LocalDate savedLd = sql.selectFrom(DATE_TEST).fetchOne(DATE_TEST.DATE_);
      assertEquals(savedLd, ld, "offset=" + offset);
      sql.delete(DATE_TEST).execute();
    }
  }
  </code></pre>
  
  <p>My converter:</p>
  
  <pre><code>public class DateConverter implements Converter&lt;Date, LocalDate&gt;{
    @Override public LocalDate from(Date date) { return date.toLocalDate(); }
    @Override public Date to(LocalDate ld) { return Date.valueOf(ld); }
    @Override public Class&lt;Date&gt; fromType() { return Date.class; }
    @Override public Class&lt;LocalDate&gt; toType() { return LocalDate.class; }
  }
  </code></pre>
  
  <p>I have tried various variations but none worked...</p>