import dayjs from "dayjs"; import React, { useContext } from "react"; import { MONTHS } from "../../constants"; import DatepickerContext from "../../contexts/DatepickerContext"; import { loadLanguageModule } from "../../helpers"; import { RoundedButton } from "../utils"; interface Props { currentMonth: number; clickMonth: (month: number) => void; style?: string } const Months: React.FC = ({ currentMonth, clickMonth, style }) => { const { i18n } = useContext(DatepickerContext); loadLanguageModule(i18n); return (
{MONTHS.map((item) => ( { clickMonth(item); }} active={currentMonth === item} > <>{dayjs(`2022-${item}-01`).locale(i18n).format(style === "google" ? "MMMM" :"MMM")} ))}
); }; export default Months;