File size: 871 Bytes
cf86710 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import { DateLib, type DateLibOptions } from "../classes/DateLib.js";
/**
* Formats the caption of the month.
*
* @defaultValue Locale-specific month/year order (e.g., "November 2022").
* @param month The date representing the month.
* @param options Configuration options for the date library.
* @param dateLib The date library to use for formatting. If not provided, a new
* instance is created.
* @returns The formatted caption as a string.
* @group Formatters
* @see https://daypicker.dev/docs/translation#custom-formatters
*/
export function formatCaption(
month: Date,
options?: DateLibOptions,
dateLib?: DateLib,
) {
const lib = dateLib ?? new DateLib(options);
return lib.formatMonthYear(month);
}
/**
* @private
* @deprecated Use {@link formatCaption} instead.
* @group Formatters
*/
export const formatMonthCaption = formatCaption;
|