react-day-picker
Version:
Customizable Date Picker for React
19 lines (17 loc) • 527 B
text/typescript
import type { DateFnsMonth } from "../lib/dateLib.js";
import { enUS } from "../lib/locales.js";
/**
* Format the month number for the dropdown option label.
*
* @defaultValue The localized month name
* @group Formatters
* @see https://daypicker.dev/docs/translation#custom-formatters
*/
export function formatMonthDropdown(
/** The month number to format. */
monthNumber: number,
/** The locale to use for formatting. */
locale = enUS
): string {
return locale.localize?.month(monthNumber as DateFnsMonth);
}