I receive a date that i want to check if it is not in the right format (dd/MM/YYYY), I add an error to display, knowing my date is of type localDate. I found a lot of code to how to validate string dates but not localdate, if any one has an idea: Here is what I did for the moment and It is rejecting all dates even in the right format
LocalDate mydate;
final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/YYYY");
try {
String date = myDate.format(formatter);
LocalDate.parse(date, formatter);
}
catch (Exception e) {
errors.add(....));
}