Skip to content

fix(gigs): stabilize budget number formatting#369

Open
Zekbot001 wants to merge 1 commit into
profullstack:masterfrom
Zekbot001:money/ugig-budget-locale
Open

fix(gigs): stabilize budget number formatting#369
Zekbot001 wants to merge 1 commit into
profullstack:masterfrom
Zekbot001:money/ugig-budget-locale

Conversation

@Zekbot001
Copy link
Copy Markdown

Summary

  • pin shared budget amount formatting to en-US rather than the host locale
  • keep gig cards and gig detail pages consistent for sats-denominated amounts
  • update the extracted gig-card regression helper so formatter suites stay deterministic across environments

Paid task

https://ugig.net/gigs/abd6b2a0-e728-48cf-a46f-f99e419ed94e

Verification

  • pnpm exec vitest run src/types/budget-display.test.ts src/components/gigs/GigCardSats.test.tsx
  • pnpm exec eslint src/types/index.ts src/components/gigs/GigCard.tsx 'src/app/gigs/[id]/page.tsx' src/components/gigs/GigCardSats.test.tsx
  • git diff --check

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 31, 2026

Greptile Summary

This PR pins all toLocaleString calls involved in budget number formatting to "en-US", replacing the host-locale default that caused inconsistent output on non-English CI runners and servers. The change is applied symmetrically across the shared formatBudgetAmount utility, both rendering sites (GigCard and the gig detail page), and the extracted test helper.

  • src/types/index.ts: formatBudgetAmount now passes "en-US" to toLocaleString for both the sats and USD branches, making the shared utility deterministic everywhere it is called.
  • GigCard.tsx / page.tsx: The local fmt sats branch is pinned to "en-US"; the USD branch already used formatCurrency, which internally uses Intl.NumberFormat("en-US", …), so it was already safe.
  • GigCardSats.test.tsx: Both branches of the extracted helper's fmt are pinned, preventing false passes on CI environments with a non-en-US default locale.

Confidence Score: 5/5

Safe to merge — changes are narrowly scoped to locale pinning with no behavioural change for users already on en-US environments.

All four changed sites receive the same one-line locale pin. The USD path in GigCard and the detail page already flowed through formatCurrency (which hardcodes Intl.NumberFormat("en-US")), so those were already safe; only the sats path needed fixing and it is now fixed in both rendering sites and the shared utility. The test helper is updated in lockstep, keeping the suite deterministic on non-en-US runners. No logic, data flow, or API surface changed.

No files require special attention — all changes are isolated to the toLocaleString locale argument.

Important Files Changed

Filename Overview
src/types/index.ts Pins formatBudgetAmount to "en-US" for both the sats and USD toLocaleString calls, making output deterministic across host environments.
src/components/gigs/GigCard.tsx Pins the sats branch of the local fmt function to "en-US"; USD branch already uses formatCurrency which is locale-safe.
src/app/gigs/[id]/page.tsx Same single-line fix as GigCard.tsx — sats branch of fmt now uses "en-US" locale.
src/components/gigs/GigCardSats.test.tsx Both branches of the test-helper fmt pinned to "en-US", ensuring formatter suite is deterministic on non-en-US CI environments.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Budget amount + paymentCoin] --> B{isSats?\nSATS / LN / BTC}
    B -- yes --> C["val.toLocaleString('en-US') + ' sats'"]
    B -- no --> D{formatBudgetAmount\nor fmt in component?}
    D -- formatBudgetAmount --> E["amount.toLocaleString('en-US', {min:0, max:2}) → $X"]
    D -- GigCard / page fmt --> F["formatCurrency(val) → Intl.NumberFormat('en-US') → $X"]
    C --> G[Display string]
    E --> G
    F --> G
    G --> H[GigCard UI]
    G --> I[Gig Detail Page UI]
Loading

Reviews (1): Last reviewed commit: "fix(gigs): stabilize budget number forma..." | Re-trigger Greptile

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant