title: How to convert Date type Angular to LocalDate in Java
body: <p>I have a frontend part in Angular 7 and a backend part in Java with Spring Boot framework. I want to post to my backend a Date object. In backend I have a Local Date object. I don't need LocalDateTime object</p>
  
  <p>my date service in angular. I need to preserve Date type and not use string.</p>
  
  <pre class="lang-js prettyprint-override"><code>addDate(): Observable&lt;Date&gt; {
      let now = new Date();
      return this.http
        .post&lt;Date&gt;('/api/date', now)
        .pipe(
          tap(response =&gt; {
            return response;
          }),
          catchError(error =&gt; this.notificationService.handleError(error))
        );
    }
  </code></pre>
  
  <p>my backend service :</p>
  
  <pre class="lang-java prettyprint-override"><code>    @PostMapping
      public LocalDate addIrregularity(@RequestBody LocalDate date, HttpServletRequest request) {
          log.info(date);
          return date;
      }
  </code></pre>
  
  <p>And i have this error:</p>
  
  <blockquote>
    <p>2019-08-06 08:21:02.185  WARN 1444 --- [nio-8080-exec-4]
    .w.s.m.s.DefaultHandlerExceptionResolver : Resolved
    [org.springframework.http.converter.HttpMessageNotReadableException:
    JSON parse error: Cannot deserialize value of type
    <code>java.time.LocalDate</code> from String "2019-08-06T00:00:00.000+0000":
    Failed to deserialize java.time.LocalDate:
    (java.time.format.DateTimeParseException) Text
    '2019-08-06T00:00:00.000+0000' could not be parsed, unparsed text
    found at index 23; nested exception is
    com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot
    deserialize value of type <code>java.time.LocalDate</code> from String
    "2019-08-06T00:00:00.000+0000": Failed to deserialize
    java.time.LocalDate: (java.time.format.DateTimeParseException) Text
    '2019-08-06T00:00:00.000+0000' could not be parsed, unparsed text
    found at index 23</p>
  </blockquote>