title: javascript date to java.time.LocalDate
body: <p>I'm trying to post json data to a Controller in Java.</p>
  
  <p>This is my controller:</p>
  
  <pre><code>@ResponseBody
      @RequestMapping(value="/{schoolId}", method=RequestMethod.POST)
      public ClassGroupDTO addClassGroup(@RequestBody ClassGroupDTO classgroup, @PathVariable Integer schoolId) {
          return partyService.addClassGroup(classgroup, schoolId);
      }
  </code></pre>
  
  <p>This it the ClassGroupDTO</p>
  
  <pre><code>    public class ClassGroupDTO extends PartyDTO {
      private PartyDTO titular;
      private SiteDTO site;
      @JsonDeserialize(using = LocalDateDeserializer.class)
      private LocalDate startDate;
      @JsonDeserialize(using = LocalDateDeserializer.class)
      private LocalDate endDate;
  ...
  }
  </code></pre>
  
  <p>I'm using Jackson 2.4.3.</p>
  
  <p>I'm not able to post data when the field startDate or endDate is given.
  I've tried several formats to post. (I'm using moment.js)</p>
  
  <pre><code>data.startDate = moment().toDate();
  data.startDate = moment().toJSON();
  data.startDate = moment().format("YYYY/MM/DD");
  </code></pre>
  
  <p>Everytime I receive a Bad Request error.
  When I leave out startDate or endDate the data is posted and the controller is triggered.</p>
  
  <p>How to deserialize javascript date to java.time.LocalDate?</p>