• Checks if the given value is a valid Dayjs duration.

    A duration is considered valid if and only if:

    • it passes dayjs.isDuration()
    • its numeric value is a finite number (i.e., duration.asMilliseconds() is not 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

    Parameters

    • Optionaloptions: {
          allow_invalid?: boolean;
      } & ValidationOptions

      Accepts the following options (in addition to generic class-validator options):

      • allow_invalid: boolean = false If true, allow the duration to be invalid.

    Returns PropertyDecorator