Axinom Mosaic Libraries
    Preparing search index...

    Function createDateRangeFilterValidators

    • Generates two functions for validating Date Ranges. Inputs for this function expects the date filters to be defined under a single key in FilterValues.

      Type Parameters

      • T

      Parameters

      Returns [
          (key: keyof T) => FilterValidatorFunction<T>,
          (key: keyof T) => FilterValidatorFunction<T>,
      ]

      const [createFromValidator, createToValidator] = createDateRangeValidators<T>();
      const filters = FilterType<T>[] = {
      {
      label: 'Creation Period (From)',
      property: 'createdAt',
      type: FilterTypes.Date,
      onValidate: createFromValidator('createdAt'),
      },
      {
      label: 'Creation Period (To)',
      property: 'createdAt',
      type: FilterTypes.Date,
      onValidate: createToValidator('createdAt'),
      }
      }