title: Jackson to deserialize Joda LocalDate from ISO DateTime
body: <p>I am using Angular date picker to send my MVC controller a date, using a Javascript Date object which is an ISO date/<strong>time</strong>.</p>
  
  <p>On deserializing <code>java.util.Date</code> it works like a charm and Hibernate will care about cutting that <code>Date</code>time to a plain Date when inserting records.</p>
  
  <p>But now that I am transitioning from <code>java.util.Date</code> to <code>org.joda.time.[APPROPRIATE_CLASS_HERE]</code> I am facing this deserialization issue.</p>
  
  <p>It is my understanding that if I force <code>DateTime</code> in my DTOs Jackson will deserialize them correctly, while instead I prefer to drop time information when the target type is a Date.</p>
  
  <p>E.g.</p>
  
  <pre><code>public class UserDto {
  
      private LocaLDate passwordExpirationDate;
  
  }
  
  
  {
     "username":"9493",
     "completeName":"ljdjf",
     "email":"wesf@dsgfds",
     "cultureId":"IT",
     "enabled":false,
     "passwordExpirationDate":"2017-07-13T10:00:00.000Z",
     "accountExpirationDate":"2017-07-20T10:00:00.000Z"
  }
  </code></pre>
  
  <p>Instead I get this:</p>
  
  <pre><code>org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Invalid format: "2017-07-13T10:00:00.000Z" is malformed at "T10:00:00.000Z"; nested exception is com.fasterxml.jackson.databind.JsonMappingException: Invalid format: "2017-07-13T10:00:00.000Z" is malformed at "T10:00:00.000Z" (through reference chain: it.phoenix.web.data.dtos.admin.profile.UserDTO["passwordExpirationDate"])
      at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:244) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE]
  Caused by: com.fasterxml.jackson.databind.JsonMappingException: Invalid format: "2017-07-13T10:00:00.000Z" is malformed at "T10:00:00.000Z" (through reference chain: it.phoenix.web.data.dtos.admin.profile.UserDTO["passwordExpirationDate"])
      at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:388) ~[jackson-databind-2.8.9.jar:2.8.9]
  Caused by: java.lang.IllegalArgumentException: Invalid format: "2017-07-13T10:00:00.000Z" is malformed at "T10:00:00.000Z"
      at org.joda.time.format.DateTimeFormatter.parseLocalDateTime(DateTimeFormatter.java:900) ~[joda-time-2.9.9.jar:2.9.9]
      at org.joda.time.format.DateTimeFormatter.parseLocalDate(DateTimeFormatter.java:844) ~[joda-time-2.9.9.jar:2.9.9]
      at com.fasterxml.jackson.datatype.joda.deser.LocalDateDeserializer.deserialize(LocalDateDeserializer.java:39) ~[jackson-datatype-joda-2.8.9.jar:2.8.9]
      at com.fasterxml.jackson.datatype.joda.deser.LocalDateDeserializer.deserialize(LocalDateDeserializer.java:15) ~[jackson-datatype-joda-2.8.9.jar:2.8.9]
      at com.fasterxml.jackson.databind.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:504) ~[jackson-databind-2.8.9.jar:2.8.9]
      at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:104) ~[jackson-databind-2.8.9.jar:2.8.9]
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:357) ~[jackson-databind-2.8.9.jar:2.8.9]
      at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:148) ~[jackson-databind-2.8.9.jar:2.8.9]
      at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3814) ~[jackson-databind-2.8.9.jar:2.8.9]
      at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2938) ~[jackson-databind-2.8.9.jar:2.8.9]
      at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:241) ~[spring-web-4.3.9.RELEASE.jar:4.3.9.RELEASE]
      ... 92 more
  </code></pre>
  
  <p>Question is: is there a smart way so that Jackson can decode DateTime object into a Joda <code>LocalDate</code> by simply stripping the time part at default/current time zone?</p>
  
  <p>Notes:
   - I already have Jackson Joda module dependency
   - Jackson is 2.8.9
   - I am forced to use Java 7. In a related Java 8 project I have no such problem with <code>java.time</code> stuff (and Jackson JSR310 module)</p>