@spaced-out/ui-design-system
Version:
Sense UI components library
70 lines • 4.56 kB
TypeScript
import type { Moment } from 'moment';
import type { DateRange, DateRangePickerError, DateRangePickerErrorTypes, DateRangeWithTimezone, TimeUnit } from '../../types/date-range-picker';
import type { MenuOption } from '../../components/Menu';
export declare const makeKey: (value: string) => string;
export declare const NAVIGATION_ACTION: Readonly<{
NEXT: "next";
PREV: "prev";
}>;
export declare const MARKERS: Readonly<{
DATE_RANGE_START: "FIRST";
DATE_RANGE_END: "SECOND";
}>;
export declare const WEEKDAYS: readonly ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
export declare const getMonths: (t?: ((key: string, fallback: string) => string) | null) => Array<MenuOption>;
export declare const getDateRangePickerErrors: (t?: ((key: string, fallback: string) => string) | null) => DateRangePickerErrorTypes;
export declare const checkRangeValidity: (rangeStart: string | null | undefined, rangeEnd: string | null | undefined, errorBody: DateRangePickerError, onError?: (arg1: DateRangePickerError) => void) => boolean;
export declare const wrangleMoment: (date?: string | Date | Moment) => Date;
export declare const formatIsoDate: (date?: Moment | string | Date, format?: string) => string;
export declare const isStartOfRange: ({ startDate }: DateRange, date: string) => boolean;
export declare const isEndOfRange: ({ endDate }: DateRange, date: string) => boolean;
export declare const inDateRange: ({ startDate, endDate }: DateRange, date: string) => boolean;
export declare const isStartDateEndDateSame: ({ startDate, endDate, }: DateRange) => boolean;
export declare const getDaysInMonth: (date: string) => Array<Array<string>>;
export declare const getAddedDate: (date: Moment | string, addCount: number, timeUnit: TimeUnit) => string;
export declare const getSubtractedDate: (date: Moment | string, subtractCount: number, timeUnit: TimeUnit) => string;
export declare const getMonthEndDate: (date: Moment | string) => string;
export declare const getTimezones: (t?: ((key: string, fallback: string) => string) | null) => Array<MenuOption>;
export declare const generateAvailableYears: ({ marker, minDate, maxDate, rangeStartMonth, rangeEndMonth, }: {
marker?: (typeof MARKERS)[keyof typeof MARKERS];
minDate: string;
maxDate: string;
rangeStartMonth?: string;
rangeEndMonth?: string;
}) => Array<MenuOption>;
export declare const getAvailableMonths: ({ marker, minDate, maxDate, rangeStartMonth, rangeEndMonth, t, }: {
marker: (typeof MARKERS)[keyof typeof MARKERS];
minDate: string;
maxDate: string;
rangeStartMonth: string;
rangeEndMonth: string;
t: ((key: string, fallback: string) => string) | null | undefined;
}) => Array<MenuOption>;
export declare const getAvailableMonthsSingleCalendar: ({ date, minDate, maxDate, t, }: {
date: string;
minDate: string;
maxDate: string;
t: ((key: string, fallback: string) => string) | null | undefined;
}) => Array<MenuOption>;
export declare const getValidDates: ({ selectedDateRange, minDate, maxDate, today, onError, t, }: {
selectedDateRange: DateRangeWithTimezone;
minDate?: string | null | undefined;
maxDate?: string | null | undefined;
today: string;
onError?: (arg1: DateRangePickerError) => void;
t: ((key: string, fallback: string) => string) | null | undefined;
}) => {
validMinDate: string;
validMaxDate: string;
validDateRange: DateRange;
};
export declare const isSame: (date1: Moment | string | Date, date2: Moment | string | Date, unit: "d" | "month") => boolean;
export declare const isBefore: (date1: Moment | string | Date, date2: Moment | string | Date) => boolean;
export declare const isAfter: (date1: Moment | string | Date, date2: Moment | string | Date) => boolean;
export declare const isSameOrBefore: (date1?: Moment | string | Date | null, date2?: Moment | string | Date | null, unit?: "d" | "month") => boolean;
export declare const isSameOrAfter: (date1?: Moment | string | Date | null, date2?: Moment | string | Date | null, unit?: "d" | "month") => boolean;
export declare const isBetween: (date: Moment | string | Date, startRange: Moment | string | Date, endRange: Moment | string | Date) => boolean;
export declare const isValid: (date?: string | null) => boolean;
export declare const getFormattedDate: (marker: string, dateRange: DateRange, locale?: string) => string;
export declare const getTranslation: (t: ((key: string, fallback: string) => string) | null | undefined, labelToTranslate: string) => string;
//# sourceMappingURL=date-range-picker.d.ts.map