Skip to content

Date Range

Interface

export type IDateRangeTypeValue = {
    start: string | null;
    end: string | null;
} | null;
 
export interface IDateRangeField extends CommonField {
    type: 'date-range';
    options?: {
        placeholder?: string;
        format?: string;
    };
    private?: () => Promise<IDateTypeValue>;
    render?: (v: IDateTypeValue) => JSX.Element;
    validation?: Validation<IDateRangeTypeValue>;
}

Example

{
  type: 'date-range',
  name: 'YOUR_PATH',
  options: {
    placeholder: 'Select a date range',
    format: 'yyyy-MM-dd'
  },
  validation: z .object({
              start: z.string(),
              end: z.string()
            })
}