Open-source personal finance manager. Self-hosted, privacy-first.
fix(frontend): calendar month localization (#420)
jorishaenseler15c8bb1f5756ed
diff --git a/frontend/src/pages/budgets.tsx b/frontend/src/pages/budgets.tsxindex cb5c60bb..be3c79e1 100644--- a/frontend/src/pages/budgets.tsx+++ b/frontend/src/pages/budgets.tsx@@ -1,6 +1,7 @@import React, { useState } from 'react'import { useTranslation } from 'react-i18next'-import { useDisplayLocale, useDateLocale } from '@/hooks/use-display-locale'+import { useDisplayLocale } from '@/hooks/use-display-locale'+import { monthLabel } from '@/lib/month-utils'import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'import { categories as categoriesApi, categoryGroups as groupsApi, budgets as budgetsApi } from '@/lib/api'import { toast } from 'sonner'@@ -60,7 +61,6 @@ export default function BudgetsPage() {const { canWrite } = useWorkspace()const userCurrency = user?.preferences?.currency_display ?? 'USD'const locale = useDisplayLocale()- const dateLocale = useDateLocale()const queryClient = useQueryClient()const [selectedMonth, setSelectedMonth] = useState(currentMonth)const [monthCalOpen, setMonthCalOpen] = useState(false)@@ -126,7 +126,8 @@ export default function BudgetsPage() {)}- const monthTitle = new Date(selectedMonth + '-02').toLocaleDateString(dateLocale, { month: 'long', year: 'numeric' }).replace(/^\w/, c => c.toUpperCase())+ const uiLocale = i18n.resolvedLanguage ?? i18n.language+ const monthTitle = monthLabel(selectedMonth, uiLocale).replace(/^\w/, c => c.toUpperCase())return (<div>diff --git a/frontend/src/pages/dashboard.tsx b/frontend/src/pages/dashboard.tsxindex 32a6839d..d1ec54a5 100644--- a/frontend/src/pages/dashboard.tsx+++ b/frontend/src/pages/dashboard.tsx@@ -149,7 +149,8 @@ export default function DashboardPage() {const dateFnsLocale = resolveDateFnsLocale(i18n.resolvedLanguage ?? i18n.language)const { from: monthStart, to: monthEnd } = monthRange(selectedMonth)const monthParam = monthStart- const monthLabelStr = monthLabel(selectedMonth, dateLocale)+ const uiLocale = i18n.resolvedLanguage ?? i18n.language+ const monthLabelStr = monthLabel(selectedMonth, uiLocale)const handleMonthChange = (newMonth: string) => {setSelectedMonth(newMonth)@@ -518,7 +519,7 @@ export default function DashboardPage() {{/* Header */}<PageHeadersection={greeting}- title={new Date(selectedMonth + '-02').toLocaleDateString(dateLocale, { month: 'long', year: 'numeric' }).replace(/^\w/, c => c.toUpperCase())}+ title={monthLabel(selectedMonth, uiLocale).replace(/^\w/, c => c.toUpperCase())}action={<div className="flex items-center gap-1"><button@@ -532,7 +533,7 @@ export default function DashboardPage() {className="inline-flex items-center justify-center gap-2 border border-border rounded-lg px-3 py-1.5 text-sm bg-card text-foreground hover:bg-muted/50 transition-all cursor-pointer min-w-[180px]"><CalendarIcon className="size-3.5 text-muted-foreground" />- {new Date(selectedMonth + '-02').toLocaleDateString(dateLocale, { month: 'long', year: 'numeric' }).replace(/^\w/, c => c.toUpperCase())}+ {monthLabel(selectedMonth, uiLocale).replace(/^\w/, c => c.toUpperCase())}</button></PopoverTrigger><PopoverContent align="center" className="w-auto p-0">@@ -891,7 +892,7 @@ export default function DashboardPage() {<Tooltipformatter={(value, name) => [value !== null ? (privacyMode ? MASK : formatCurrency(Number(value), userCurrency, locale)) : '\u2014',- name === 'current' ? monthLabel(selectedMonth, dateLocale).split(' ')[0] : monthLabel(prevMonth, dateLocale).split(' ')[0],+ name === 'current' ? monthLabel(selectedMonth, uiLocale).split(' ')[0] : monthLabel(prevMonth, uiLocale).split(' ')[0],]}labelFormatter={(day) => t('dashboard.day', { day })}contentStyle={{@@ -938,7 +939,7 @@ export default function DashboardPage() {<div className="px-5 pb-4 pt-0 shrink-0"><p className="text-xs text-muted-foreground">{t('dashboard.balanceFlowVsPrev', {- month: monthLabel(prevMonth, dateLocale).split(' ')[0],+ month: monthLabel(prevMonth, uiLocale).split(' ')[0],day: footerDay,amount: mask(formatCurrency(footerPrev, userCurrency, locale)),delta: `${footerPct >= 0 ? '+' : ''}${footerPct.toFixed(1)}%`,diff --git a/frontend/src/pages/transactions.tsx b/frontend/src/pages/transactions.tsxindex 72bf1a38..d5f418d7 100644--- a/frontend/src/pages/transactions.tsx+++ b/frontend/src/pages/transactions.tsx@@ -80,7 +80,7 @@ function parseHashtags(notes: string | null): string[] {}export default function TransactionsPage() {- const { t } = useTranslation()+ const { t, i18n } = useTranslation()const [searchParams] = useSearchParams()const navigate = useNavigate()const locale = useDisplayLocale()@@ -1138,7 +1138,7 @@ export default function TransactionsPage() {<MonthSteppervalue={steppedMonth}onChange={handleMonthChange}- locale={dateLocale}+ locale={i18n.resolvedLanguage ?? i18n.language}prevLabel={t('transactions.monthPrevious')}nextLabel={t('transactions.monthNext')}/>