0

I would like to provide bean-validation for variable which is of the LocalDate type. The minimum acceptable value should be LocalDate.of(2020,1,1). The maximum acceptable value should be LocalDate.of(5874897,1,1).

Michał
  • 1
  • 1
  • 1
    [`isAfter`](https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html#isAfter-java.time.chrono.ChronoLocalDate-) and [`isBefore`](https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html#isBefore-java.time.chrono.ChronoLocalDate-) – Stephen P May 17 '22 at 16:27

2 Answers2

0

Jakarta Bean Validation 2.0 added support for the java.time classes defined in JSR 310.

Search for articles and videos showing the new features. Read JSR 380.

I expect you can use @Min, and @Max with LocalDate but I’ve not yet verified.

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
-1

You can use isBefore and isAfter method as shown here https://docs.oracle.com/javase/8/docs/api/java/time/LocalDate.html

sj221
  • 54
  • 2