minAge, maxAge, today, withinNext and withinLast read the
clock of the configuration, so tests can fix it. The windows take a kotlin.time.Duration, such as
30.days.
A
null argument checks nothing. A rule that reads a value that may be missing, such as max(customer.limit),
never fails because of it: required on that value reports it once.Appointment.kt
Age
minAge
minAge(min) on LocalDate
Checks that someone born on the date is at least min years old today.
minAge
maxAge
maxAge(max) on LocalDate
Checks that someone born on the date is at most max years old today.
maxAge
Around now
today
today() on LocalDate, LocalDateTime, ZonedDateTime, OffsetDateTime
Checks that the date falls on today.
It is moved to the zone of the clock before its date is compared.
today
withinNext
withinNext(duration) on LocalDate, LocalDateTime, ZonedDateTime, OffsetDateTime, Instant
Checks that the date is between today and duration from today, both included.
withinNext
withinLast
withinLast(duration) on LocalDate, LocalDateTime, ZonedDateTime, OffsetDateTime, Instant
Checks that the date is between duration before today and today, both included.
withinLast
Days of the week
weekday
weekday() on LocalDate, LocalDateTime, ZonedDateTime, OffsetDateTime
Checks that the date falls from Monday to Friday.
weekday
weekend
weekend() on LocalDate, LocalDateTime, ZonedDateTime, OffsetDateTime
Checks that the date falls on a Saturday or a Sunday.
weekend