@codecademy/gamut
68.2.268.2.3-alpha.794432.0
dist/DatePicker/Calendar/utils/format.d.ts+
dist/DatePicker/Calendar/utils/format.d.tsNew file+44
Index: package/dist/DatePicker/Calendar/utils/format.d.ts
===================================================================
--- package/dist/DatePicker/Calendar/utils/format.d.ts
+++ package/dist/DatePicker/Calendar/utils/format.d.ts
@@ -0,0 +1,44 @@
+import type { IsoWeekday } from '../../utils/locale';
+/**
+ * Capitalize the first character of a string using the locale; rest unchanged (e.g. "next month" → "Next month").
+ */
+export declare const capitalizeFirst: (str: string, locale: Intl.Locale) => string;
+/**
+ * Format month and year for the calendar header (e.g. "February 2026").
+ */
+export declare const formatMonthYear: (date: Date, locale: Intl.Locale) => string;
+/**
+ * Get weekday names for column headers or abbr attributes.
+ * Column order follows `firstWeekday` (ISO 1 = Monday … 7 = Sunday), matching `Intl.Locale#getWeekInfo().firstDay`.
+ * @param format - 'short' for abbreviated (e.g. "Su", "Mo"), 'long' for full (e.g. "Sunday", "Monday")
+ */
+export declare const getWeekdayNames: (format: "short" | "long", locale: Intl.Locale, firstWeekday: IsoWeekday) => string[];
+/**
+ * Get localized "next month" and "previous month" labels for calendar nav.
+ * Uses Intl.RelativeTimeFormat with numeric: "auto" (e.g. "next month", "last month").
+ */
+export declare const getRelativeMonthLabels: (locale: Intl.Locale) => {
+ nextMonth: string;
+ lastMonth: string;
+};
+/**
+ * Get localized "today" label (e.g. "today").
+ */
+export declare const getRelativeTodayLabel: (locale: Intl.Locale) => string;
+/**
+ * Get the locale's short date format pattern (e.g. "MM/DD/YYYY" for en-US,
+ * "DD/MM/YYYY" for en-GB). Uses Intl.DateTimeFormat formatToParts to infer
+ * order and separators. Useful for parsing or building locale-aware inputs.
+ */
+export declare const getDateFormatPattern: (locale: Intl.Locale) => string;
+/**
+ * Format a date for display in the date picker input (e.g. "2/15/2026").
+ */
+export declare const formatDateForInput: (date: Date, locale: Intl.Locale) => string;
+/**
+ * Parse a string from the date input into a Date, or null if invalid.
+ * Only returns a date when the input is a complete valid date (e.g. "2/15/2026").
+ * Partial input like "1" or "2/15" returns null even though Date("1") would parse.
+ */
+export declare const parseDateFromInput: (value: string, locale: Intl.Locale) => Date | null;
+export declare const formatDateForAriaLabel: (date: Date, locale: Intl.Locale) => string;