@codecademy/gamut
68.2.268.2.3-alpha.93a7da.0
dist/DatePicker/DatePickerCalendar/utils/quickActions.d.ts+
dist/DatePicker/DatePickerCalendar/utils/quickActions.d.tsNew file+30
Index: package/dist/DatePicker/DatePickerCalendar/utils/quickActions.d.ts
===================================================================
--- package/dist/DatePicker/DatePickerCalendar/utils/quickActions.d.ts
+++ package/dist/DatePicker/DatePickerCalendar/utils/quickActions.d.ts
@@ -0,0 +1,30 @@
+import { CalendarQuickAction } from '../../sharedTypes';
+import { DatePickerTranslations } from '../../utils/translations';
+export declare const getDefaultSingleQuickActions: (locale: Intl.Locale) => CalendarQuickAction[];
+export declare const getDefaultRangeQuickActions: (translations: Required<DatePickerTranslations>) => CalendarQuickAction[];
+/**
+ * Computes `[startDate, endDate]` for footer quick actions when `onClick` is omitted.
+ * `anchorDate` (local calendar day of `now`) is the anchor — returned as `endDate` unless the range
+ * is reordered (see below).
+ *
+ * **Rolling** offsets (no month/year boundaries):
+ * - **day**: `num` days from anchor.
+ * - **week**: `num × 7` days.
+ * - **month**: `num × 30` days.
+ * - **year**: `num × 365` days.
+ *
+ * **Range mode (`isRange: true`):** if the computed day is after the anchor day, returns
+ * `{ startDate: anchor, endDate: computed }` so the interval runs forward. Otherwise
+ * `{ startDate: computed, endDate: anchor }` (past through “today”).
+ *
+ * **Single mode:** same return shape; the calendar uses `startDate` as the selected day.
+ */
+export declare const computeQuickAction: ({ num, timePeriod, isRange, now, }: {
+ num: number;
+ timePeriod: CalendarQuickAction["timePeriod"];
+ isRange: boolean;
+ now?: Date;
+}) => {
+ startDate: Date;
+ endDate: Date;
+};