Skip to content

Conversation

@patyork
Copy link
Contributor

@patyork patyork commented Nov 22, 2025

Default formatting for number data-table columns updated to use calculated maxFractionalDigits based on locale.

📝 Summary

By default, a data-table uses Intl.NumberFormat with no options to display number types that have no explicit format. This can lead to rounding-when-displayed by default, which is antithetical to the expected behavior when displaying raw data (e.g. without explicit formatting).

🔍 Description of Changes

Used the existing maxFractionalDigits function from the number utils to invoke the useNumberFormatter function with a value for the maximumSignificantDigits parameter.

📋 Checklist

  • I have read the contributor guidelines.
  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • I have added tests for the changes made.
  • I have run the code and verified that it works as expected.

Note

Make data-table number rendering locale-aware with max fractional digits and add comprehensive LocaleNumber tests; minor test cleanups.

  • Data Table:
    • LocaleNumber: Exported and updated in frontend/src/components/data-table/columns.tsx to use useLocale and maxFractionalDigits(locale) via useNumberFormatter({ maximumFractionDigits }).
  • Tests:
    • Columns: Added extensive tests in __tests__/columns.test.tsx for LocaleNumber across locales (en-US, de-DE, fr-FR, ja-JP) and edge cases (integers, zeros, negatives, large/small numbers, Infinity, -Infinity, NaN, scientific notation).
    • Logs: Updated timestamps in frontend/src/core/cells/__tests__/logs.test.ts to use numeric separators; no behavior changes.
    • ProgressPlugin: Minor type tweak in frontend/src/plugins/layout/__test__/ProgressPlugin.test.ts for Cases tuple typing.

Written by Cursor Bugbot for commit 69f8f7d. This will update automatically on new commits. Configure here.

Default formatting for number data-table columns updated to use calculated maxFractionaldigits based on locale.
@vercel
Copy link

vercel bot commented Nov 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
marimo-docs Ready Ready Preview Comment Nov 25, 2025 4:39pm
Moved the call of maxFractionalDigits to the Column level instead of each cell, as it could be expensive to call on some browsers or locales. Additionally, this value should not change on a table-cell level (or any time, actually; should really be a global constant computed once).
@mscolnick
Copy link
Contributor

hey @patyork this looks great. there are a few typecheck and lint issues. let us know if you need help fixing these up

@mscolnick mscolnick merged commit 3d35013 into marimo-team:main Nov 25, 2025
23 checks passed
@Light2Dark Light2Dark added the enhancement New feature or request label Nov 25, 2025
@mscolnick mscolnick added the bug Something isn't working label Nov 25, 2025
@patyork patyork deleted the data-table-locale-number-default-take2 branch November 25, 2025 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

3 participants