I'm suggesting a field be added to the @PastOrPresent (and @FutureOrPresent) bean validation annotation annotations that provides a Duration which is a buffer on the time used to determine the clock value of "Present". Possibly something like:
{code:java} @PastOrPresent(within=5, units=TimeUnit.MINUTES) {code}
I know that you can provide your own clock provider as explained [here|http://adambien.blog/roller/abien/entry/time_travelling_with_bean_validation] but that will impact all clock requests and you may not want all requests with the same duration. Such as if you're validating an Instant, some cases you may want precision to the minute but other cases you may want it to the millisecond. |
|