From 8271ac0ccaecbb36337698b72a7bca0ec140fdc3 Mon Sep 17 00:00:00 2001 From: Sendou <38327916+Sendouc@users.noreply.github.com> Date: Mon, 29 Jun 2020 18:11:30 +0300 Subject: [PATCH] fix modes accordion always 2020 bug --- frontend-react/src/components/user/ModesAccordion.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/frontend-react/src/components/user/ModesAccordion.tsx b/frontend-react/src/components/user/ModesAccordion.tsx index 344f5ea5b..661469ae0 100644 --- a/frontend-react/src/components/user/ModesAccordion.tsx +++ b/frontend-react/src/components/user/ModesAccordion.tsx @@ -52,10 +52,11 @@ interface StyleBoxProps { size?: string } -const getLocalizedMonth = (month: number, year: number, locale: string) => { +const getLocalizedMonthYear = (month: number, year: number, locale: string) => { const date = new Date() date.setDate(1) date.setMonth(month - 1) + date.setFullYear(year) return date.toLocaleString(locale, { month: "long", year: "numeric" }) } @@ -97,7 +98,7 @@ const accordionReducer = function ( ): AllModesAccordionData { const key = modesShort[cur.mode] const modeData = acc[key] - const date = getLocalizedMonth(cur.month, cur.year, acc.locale) + const date = getLocalizedMonthYear(cur.month, cur.year, acc.locale) if (!modeData) { acc[key] = { highestPlacement: cur.rank, @@ -219,7 +220,7 @@ const ModesAccordion: React.FC = ({ placements }) => { fontSize="xs" color={grayWithShade} > - {getLocalizedMonth( + {getLocalizedMonthYear( placement.month, placement.year, i18n.language