Skip to content

fix(app): formatMinutes ignores app locale, breaking CI on non-pt-BR runners #236

Description

@alltomatos

Contexto

unit (linux) is currently red on dev (confirmed on the latest dev commit, e.g. run https://github.com/alltomatos/opencode/actions/runs/34911995346/job/104201311221, and on the two runs before it) and blocks every PR's CI, including #234.

Bug

formatMinutes() in packages/app/src/pages/stats/stats-controller.ts calls mins.toLocaleString() with no locale argument, so it silently uses the CI runner's/browser's default locale. Every other numeric/date formatter in the stats page (numFmt, compactFmt, the session-time formatter) explicitly passes language.intl() — formatMinutes is the one outlier.

Its unit test (stats-controller.test.ts) hardcodes the pt-BR-style output ("60.327 min", period as thousands separator) that this fork's default locale produces locally, but GitHub's ubuntu-latest runners default to a locale that renders it as "60,327 min" — so the test (and therefore unit (linux)) fails there regardless of which PR triggers it.

Fix

  • formatMinutes(ms, locale?) now accepts and forwards an explicit locale, matching the other formatters in this file.
  • stats.tsx's three call sites now pass language.intl().
  • The unit test now pins "pt-BR" explicitly instead of relying on whatever locale the process happens to default to, so it's deterministic on any runner.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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