Skip to main content
“Must be in the future”, “at least 18 years old” and “within the next 30 days” all depend on what now is. Validity never reads the system clock directly: every rule about the present reads the clock of the configuration. By default it is the system clock in the default time zone.
Trial.kt
With the clock fixed on 2 November 2026, a trial for someone born in 2010 that starts in January breaks three rules:

The rules that read the clock

The rules that compare two values, such as after(other) or weekday(), do not read the clock.

now, in your own rules

now(of) reads the current time from the clock of the validation in progress, so a custom rule follows a fixed clock the same way the built-in ones do:
of is any function that takes a Clock, such as LocalDate::now, Instant::now or ZonedDateTime::now.

Fixing the clock

Pass a Validity with a fixed clock to the call under test. The default configuration does not change, so tests that run in parallel do not see each other’s clocks:
A zoned or offset date and time is moved to the zone of the clock before today compares its date.