UNPKG

633 BPlain TextView Raw
1import { FormatOptions, dateLib as defaultDateLib } from "../lib/index.js";
2import type { DateLib } from "../types/index.js";
3
4/**
5 * Format the caption of the month.
6 *
7 * @defaultValue `LLLL y` (e.g. "November 2022")
8 * @group Formatters
9 * @see https://daypicker.dev/docs/translation#custom-formatters
10 */
11export function formatCaption(
12 month: Date,
13 options?: FormatOptions,
14 /** @ignore */
15 dateLib: DateLib = defaultDateLib
16) {
17 return dateLib.format(month, "LLLL y", options);
18}
19
20/**
21 * @private
22 * @deprecated Use {@link formatCaption} instead.
23 * @group Formatters
24 */
25export const formatMonthCaption = formatCaption;