Localization sweep: shared es-CR dates module, no more en-US strays

src/lib/dates.ts is the single source for month names and date
formatting; the three per-page month arrays are gone (with an
off-by-one guard — the shared array is 1-indexed). formatDate and the
Analytics chart tooltips now speak es-CR, Analytics headings are
Spanish, and the cycle selector says 'Todo el período' (UX-19, FE-17,
UX-07).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Carlos Escalante
2026-06-10 17:59:16 -06:00
parent cdfa4ad90a
commit 8b7f3dff40
7 changed files with 42 additions and 20 deletions

View File

@@ -65,7 +65,7 @@ const trendChartConfig = {
const dailyChartConfig = {
total: {
label: 'Daily Spending',
label: 'Gasto Diario',
color: 'var(--chart-2)',
},
} satisfies ChartConfig;
@@ -127,7 +127,7 @@ export default function Analytics() {
<BarChart3 className="w-5 h-5 text-primary" />
<h1 className="text-2xl font-bold font-heading">Analytics</h1>
</div>
<p className="text-sm text-muted-foreground mt-1">Spending breakdown and trends</p>
<p className="text-sm text-muted-foreground mt-1">Desglose y tendencias de gasto</p>
</div>
<BillingCycleSelector value={cycle} onChange={setCycle} />
</div>
@@ -150,7 +150,7 @@ export default function Analytics() {
<CardContent>
{byCategory.length === 0 ? (
<div className="h-64 flex items-center justify-center text-muted-foreground text-sm">
No data for this period
Sin datos para este período
</div>
) : (
<div className="flex flex-col items-center">
@@ -248,7 +248,7 @@ export default function Analytics() {
<CardContent>
{daily.length === 0 ? (
<div className="h-48 flex items-center justify-center text-muted-foreground text-sm">
No data for this period
Sin datos para este período
</div>
) : (
<ChartContainer data-sensitive config={dailyChartConfig} className="h-[240px] w-full">
@@ -272,7 +272,7 @@ export default function Analytics() {
<ChartTooltipContent
formatter={(value) => formatCRC(Number(value))}
labelFormatter={(label) =>
new Date(label).toLocaleDateString('en-US', { month: 'short', day: 'numeric' })
new Date(label).toLocaleDateString('es-CR', { month: 'short', day: 'numeric' })
}
/>
}