UNPKG

770 BTypeScriptView Raw
1import React from "react";
2
3import { format } from "date-fns";
4import { it } from "date-fns/locale";
5import { DayPicker } from "react-day-picker";
6
7export function ItalianLabels() {
8 return (
9 <DayPicker
10 locale={it}
11 labels={{
12 labelDayButton: (date, { today, selected }) => {
13 let label = format(date, "PPPP");
14 if (today) label = `Oggi, ${label}`;
15 if (selected) label = `${label}, selezionato`;
16 return label;
17 },
18 labelWeekNumber: (weekNumber) => `Settimana ${weekNumber}`,
19 labelNext: () => "Prossimo mese",
20 labelPrevious: () => "Mese precedente",
21 labelMonthDropdown: () => "Seleziona il mese",
22 labelYearDropdown: () => "Seleziona l'anno"
23 }}
24 />
25 );
26}