Checks if the given value is a valid Dayjs duration.
A duration is considered valid if and only if:
duration.asMilliseconds()
NaN
This requires the duration-plugin to be loaded. If this is not the case, an error will be thrown.
// Ensure the value is a Dayjs duration.@IsDuration()value: Duration Copy
// Ensure the value is a Dayjs duration.@IsDuration()value: Duration
Optional
Accepts the following options (in addition to generic class-validator options):
allow_invalid: boolean = false
Checks if the given value is a valid Dayjs duration.
A duration is considered valid if and only if:
duration.asMilliseconds()
is notNaN
)This requires the duration-plugin to be loaded. If this is not the case, an error will be thrown.
Example