Skip to content

i18n: make chart tooltip dates use the app locale (formatShortDate) #371

Description

@NesiciCoding

Deferred from PR #363 (CodeRabbit review: #363 (comment)).

Problem

formatShortDate(iso) (src/utils/dateInput.ts) formats via the browser locale (toLocaleDateString() with no locale argument), so tooltip dates can differ from the user's selected app language. This surfaced in the Statistics trend-chart tooltips:

  • src/components/Statistics/ClassTrendChart.tsx (tooltip label formatter)
  • src/components/Statistics/MultiClassTrendChart.tsx (tooltip label formatter)
  • other formatShortDate callers repo-wide

Why deferred

formatShortDate is a shared utility used across many charts/exports. Making it locale-aware is a cross-cutting change best done as one consistent pass (util signature + all callers) rather than a one-off in the two trend tooltips.

Suggested work

  • Add an optional locale parameter to formatShortDate (e.g. formatShortDate(iso, locale?)), passing it through to toLocaleDateString(locale, ...).
  • Update callers that render user-visible dates to pass the active i18n.language.
  • Confirm no regression in export utilities that call it.

Scope: small–medium. Non-blocking; no functional bug, just locale consistency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions