@codecademy/gamut
68.3.068.3.1-alpha.a2040c.0
dist/DatePicker/DatePickerCalendar/Calendar/utils/dateGrid.d.ts+
dist/DatePicker/DatePickerCalendar/Calendar/utils/dateGrid.d.tsNew file+74
Index: package/dist/DatePicker/DatePickerCalendar/Calendar/utils/dateGrid.d.ts
===================================================================
--- package/dist/DatePicker/DatePickerCalendar/Calendar/utils/dateGrid.d.ts
+++ package/dist/DatePicker/DatePickerCalendar/Calendar/utils/dateGrid.d.ts
@@ -0,0 +1,74 @@
+import type { IsoWeekday } from '../../../utils/locale';
+export declare const normalizeDate: (date: Date) => number;
+/**
+ * Number of empty cells before the 1st of the month, for a grid whose first column is
+ * `firstWeekday` (ISO: 1 = Monday … 7 = Sunday from `Intl.Locale#getWeekInfo`).
+ */
+export declare const getWeekdayOffsetInGrid: ({ date, firstWeekday, }: {
+ date: Date;
+ firstWeekday: IsoWeekday;
+}) => number;
+export declare const getFirstOfMonth: (date: Date) => Date;
+/**
+ * Returns an array of weeks for the given month. Each week is an array of 7 items:
+ * each item is either a Date (that day) or null (padding from previous/next month).
+ *
+ * @param year - Full year (e.g. 2026)
+ * @param month - Month 0-11 (0 = January)
+ * @param firstWeekday - First day of the week for the calendar row (ISO 1–7, from `getWeekInfo().firstDay`)
+ */
+export declare const getMonthGrid: ({ year, month, firstWeekday, }: {
+ year: number;
+ month: number;
+ firstWeekday: IsoWeekday;
+}) => (Date | null)[][];
+export declare const isSameDay: (a: Date | null, b: Date | null) => boolean;
+export declare const getOrderedCalendarEndpoints: ({ startDate, endDate, }: {
+ startDate: Date;
+ endDate: Date;
+}) => {
+ low: Date;
+ high: Date;
+};
+/**
+ * Check if `date` is between `startDate` and `endDate` (exclusive), ignoring time.
+ */
+export declare const isDateInRange: ({ date, startDate, endDate, }: {
+ date: Date;
+ startDate: Date | null;
+ endDate: Date | null;
+}) => boolean;
+/**
+ * Returns a `disableDate` callback: for each calendar `date`, `true` if it’s the same day as
+ * any in `dates`
+ *
+ * @example
+ * ```tsx
+ * <DatePicker
+ * mode="single"
+ * selectedDate={null}
+ * onSelected={() => {}}
+ * disableDate={matchDisabledDates([new Date(2026, 3, 14)])}
+ * />
+ * ```
+ */
+export declare const matchDisabledDates: (dates?: readonly Date[]) => (date: Date) => boolean;
+export declare const isDateDisabled: ({ date, disableDate, }: {
+ date: Date;
+ disableDate?: (date: Date) => boolean;
+}) => boolean;
+export type DateWithRow = {
+ date: Date;
+ rowIndex: number;
+};
+export declare const getDatesWithRow: (weeks: (Date | null)[][]) => DateWithRow[];
+export declare const addMonths: ({ date, n }: {
+ date: Date;
+ n: number;
+}) => Date;
+export declare const isDateWithinVisibleMonths: ({ date, startOfLeftVisibleMonth, showSecondMonth, }: {
+ date: Date;
+ /** First day of the month rendered in the left calendar column (`displayDate`). */
+ startOfLeftVisibleMonth: Date;
+ showSecondMonth: boolean;
+}) => boolean;