I have a method what should find object from database by inserted date. I used LocalDate class, but if I try it in swagger I get a error message. I need only dates and format should be dd/MM/yyyy. Please help :)
Error message in swagger: Failed to convert value of type 'java.lang.String' to required type 'java.time.LocalDate'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.lang.String] to type [java.time.LocalDate] for value '15/04/2022'; nested exception is java.lang.IllegalArgumentException: Parse attempt failed for value [15/04/2022]
Entity:
@Entity
@Table(name = "\"order\"")
public class Order {
@Column(name = "delivery_date", nullable = false)
private LocalDate deliveryDate
Dto:
@Data
public class OrderInfo implements Serializable {
private LocalDate deliveryDate;
Method:
@GetMapping("/orders/date")
@Operation(summary = "Find all orders by date")
public List<OrderInfo> findAllOrderByDate(LocalDate date){
return orderService.findAllOrdersByDate(date);
}