I have a form that takes a date input. I want to validate that the user isnt picking a future date. I know that there is min and max which I can place in the html, but the only examples I saw the date is hardcoded, so I tried using passing the value of the currentDate to the html by adding it to the Model
model.addAttribute("currentDate", LocalDate.now());
<input type="date" max="${currentDate}" data-th-max="${currentDate}" id="yearOfRegistration" name="yearOfRegistration"/>
<label class="error" th:errors="${initialRequestDTO.yearOfRegistration}"></label>
I do however the form accepts future dates, not as I intended it. Any suggestions?