title: How to pass Javascript Date to Java LocalDate and to LocalDateTime in REST with JAX-RS
body: <p>When I pass a Javascript Date to a JAX-RS service I receive:</p>
  
  <ol>
  <li>In case the target field is LocalDate: Text '2018-06-04T22:00:00.000Z' could not be parsed, unparsed text found at index 10". The BackEnd is ok with "2018-06-04", I tried with Postman.</li>
  <li>In case the target field is LocalDateTime: Text '2019-04-02T20:16:24.999Z' could not be parsed, unparsed text found at index 23. The BackEnd is ok with "2019-04-02T20:16:24", I tried with Postman.</li>
  </ol>
  
  <p>The information i pass to the BackEnd come from a Angular Material Datepicker component that I map on a javascript Date object.</p>
  
  <p>I understand that the string has informations that the BackEnd do not aspect but I don't know how to pass the correct/modified value before call the POST.</p>
  
  <p>Should I pass a String instead of a Date object? Is that the correct approach?</p>
  
  <p>Is there a way from a date in the format "2018-06-04T22:00:00.000Z" or "2018-06-05T00:00:00.000Z" to be passed to a LocalDate and a LocalDateTime?</p>
  
  <p>I used LocalDate and LocalDateTime because I do not want to deal with timezone.
  The value are supposed to be always the same even if I change the timezone.</p>
  
  <p>Before I had a problem because there was a 1 hour difference between the server and the client. So when i used to pick a date from the web server it could happen that the client would see the day before on the component becasue it was going back 1 hour from midnight.</p>