I have a class that is decorated with a @MinDate constraint like this:
export default class Order {
purchaseDate: Date;
@MinDate(this.purchaseDate)
receiptDate: Date;
}
When attempting to validate an instance of Order
that is valid the validation errors out. My question is is it even possible / valid to pass in this.purchaseDate
as an argument to the @MinDate()
decorator.
In other words can typescript decorators receive runtime values from an object, or do these values have to be available at compile time? So for example:
@MinDate(new Date(12/22/2017)); //This should work?
@MinDate(this.someDate) // This will never work?