@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
30 lines (29 loc) • 932 B
TypeScript
import type { DatePickerDateType } from '../DatePickerContext';
export type DatePickerDateProps = {
date?: DatePickerDateType;
startDate?: DatePickerDateType;
endDate?: DatePickerDateType;
startMonth?: DatePickerDateType;
endMonth?: DatePickerDateType;
minDate?: DatePickerDateType;
maxDate?: DatePickerDateType;
};
type UseDatesOptions = {
dateFormat: string;
isRange: boolean;
};
export type DatePickerDates = {
date?: DatePickerDateType;
startDate?: Date;
endDate?: Date;
minDate?: Date;
maxDate?: Date;
startMonth?: Date;
endMonth?: Date;
};
export default function useDates(dateProps: DatePickerDateProps, { dateFormat, isRange }: UseDatesOptions): {
readonly dates: DatePickerDates;
readonly updateDates: (newDates: DatePickerDates, callback?: (dates: DatePickerDates) => void) => void;
readonly previousDateProps: DatePickerDateProps;
};
export {};