class-validator
class-validator copied to clipboard
feature: Make `minDate` and `maxDate` support specifying dynamic date
Description
Sometime we need to check if the value is a date that's after now or a dynamic date.
Proposed solution
I have an idea. Make minDate
and MaxDate
accept a function as the date
parameter. The function return a date and will be executed when validate. Like the following code:
// MinDate(date: Date | (() => Date))
@MinDate(() => new Date())
someProperty