Files
calendar/packages/features/data-table/lib/dateRange.ts
T
720136fcf9 fix: replace filter implementations on /insights (#19033)
* fix: replace filter implementations on /insights

* add authorization for teamIds

* replace all the implementations

* provide eventTypeId

* remove log

* fix teamId for isAll

* fix Download button

* remove legacy implementations

* clean up

* nullish check

* remove unusable filters

* revert style

* fix type error

* fix e2e test

* fix type error

* fix type error

* fix e2e

* extract util method

* fix type error

* fix type error

* fix type error

---------

Co-authored-by: Benny Joo <sldisek783@gmail.com>
2025-02-10 20:28:48 +01:00

32 lines
956 B
TypeScript

import dayjs from "@calcom/dayjs";
export type PresetOptionValue = "c" | "w" | "m" | "y" | "t" | "tdy";
export type PresetOption = {
labelKey: string;
i18nOptions?: Record<string, string | number>;
value: PresetOptionValue;
};
export const CUSTOM_PRESET_VALUE = "c" as const;
export const DEFAULT_PRESET: PresetOption = {
labelKey: "last_number_of_days",
i18nOptions: { count: 7 },
value: "w",
};
export const CUSTOM_PRESET: PresetOption = { labelKey: "custom_range", value: CUSTOM_PRESET_VALUE };
export const PRESET_OPTIONS: PresetOption[] = [
{ labelKey: "today", value: "tdy" },
DEFAULT_PRESET,
{ labelKey: "last_number_of_days", i18nOptions: { count: 30 }, value: "t" },
{ labelKey: "month_to_date", value: "m" },
{ labelKey: "year_to_date", value: "y" },
CUSTOM_PRESET,
];
export const getDefaultStartDate = () => dayjs().subtract(1, "week").startOf("day");
export const getDefaultEndDate = () => dayjs().endOf("day");