title: How to solve Unparseable date:error in spring-boot
body: <p>I having difficulty trying to solve an error with my date in Spring. I think i have exhausted almost all the solution on stack overflow an i still do not have a solution. I have implement a customDateEditor and i am still get the same error.
  I am using the datepicker to select the date on the form.</p>
  
  <p>Error</p>
  
  <pre><code>Failed to convert property value of type java.lang.String to required type java.util.Date for property date; nested exception is
  
  
  java.lang.IllegalArgumentException: Could not parse date: Unparseable date: "1 March, 2017"
  </code></pre>
  
  <p>Model</p>
  
  <pre><code>@NotNull(message = "Date field must not be blank.")
      @DateTimeFormat(pattern = "dd-MM-yyyy")
      private Date date;
   public Date getDate() {
          return date;
      }
  
      public void setDate(Date date)  {
          this.date = date;
      }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code> @InitBinder
      public void allowEmptyDateBinding( WebDataBinder binder )
      {
          // Custom String Editor. tell spring to set empty values as null instead of empty string.
          binder.registerCustomEditor( String.class, new StringTrimmerEditor( true ));
  
          //Custom Date Editor
  
          SimpleDateFormat simpleDateFormat=new SimpleDateFormat("dd-MM-yyyy");
          simpleDateFormat.setLenient(false);
          binder.registerCustomEditor( Date.class, new CustomDateEditor( simpleDateFormat,true));
      }
  </code></pre>
  
  <p>Form</p>
  
  <pre><code>&lt;input th:type="date" class="form-control input-sm datepicker" th:field="*{date}"
                         placeholder="Date Of Birth"/&gt;
  </code></pre>
  
  <p>JS Script</p>
  
  <pre><code>$('.datepicker').pickadate({
      autoclose: true,
      Format: 'dd-MM-yyyy'
    });
  </code></pre>