Lucky solution is
<label for="look-date">Choose the year and month (yyyy-MM):</label>
<input type="month" th:field="${datePicker.lookDate}" id="look-date"/>
but it is important to change type to java.util.Date
@Data
public class DatePickerDto implements Serializable {
@DateTimeFormat(pattern = "yyyy-MM")
private Date lookDate;
private String dateFormat = "yyyy-MM";
}
How to enable html form to handle java.time.LocalDate
? 🤔 I don't know