• Checks if the given value is a valid Dayjs duration not longer than minimum.

    The minimum can be given as either:

    • a Dayjs duration
    • an ISO 8601 string, e.g. "PT1H"
    • a units object, e.g. { hour: 1, minute: 30 }
    • a time/unit tuple, e.g. [1, 'hour]
    // Ensure the value is a duration at least 1 hour long
    @MinDuration([1, 'hour'], { inclusive: true })
    value: Duration

    Parameters

    • minimum:
          | string
          | Duration
          | Partial<{
              days: number;
              hours: number;
              milliseconds: number;
              minutes: number;
              months: number;
              seconds: number;
              weeks: number;
              years: number;
          }>
          | [time: number, unit?: DurationUnitType]

      The minimum allowed value.

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

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

      • inclusive: boolean = false If true, allow the minimum duration as well.

    Returns PropertyDecorator