class-validator icon indicating copy to clipboard operation
class-validator copied to clipboard

feature: Make `minDate` and `maxDate` support specifying dynamic date

Open CodyTseng opened this issue 2 years ago • 0 comments

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

CodyTseng avatar Jul 11 '22 08:07 CodyTseng