react-day-picker
Version:
Customizable Date Picker for React
21 lines (19 loc) • 741 B
text/typescript
import { DateLib, type DateLibOptions } from "../classes/DateLib.js";
/**
* Generates the ARIA label for a weekday column header.
*
* @defaultValue `"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"`
* @param date - The date representing the weekday.
* @param options - Optional configuration for the date formatting library.
* @param dateLib - An optional instance of the date formatting library.
* @returns The ARIA label for the weekday column header.
* @group Labels
* @see https://daypicker.dev/docs/translation#aria-labels
*/
export function labelWeekday(
date: Date,
options?: DateLibOptions,
dateLib?: DateLib
): string {
return (dateLib ?? new DateLib(options)).format(date, "cccc");
}