Skip to content

Trim Trailing Zeros on Displayed Decimal Values #1909

Description

@maxpatiiuk

Updated requirements by @grantfitzsimmons:

There is a need to automatically trim trailing zeros on all decimal fields in Specify 7’s UI. The goal is to present numbers cleanly (e.g. display 3.7000000 as 3.7) everywhere the user sees them—without changing what’s stored in the database.

Users expect any decimal value to be shown with no unnecessary zeros as this indicates false precision. This applies uniformly in form fields, query results grids, table-format previews and aggregations, as well as on labels and printed reports. The underlying precision in MySQL remains unchanged, and any custom field-formatter settings should continue to work without disruption.

Key points:

  • Scope: every UI element where a decimal is displayed (forms, tables, queries, table formats/aggregations, labels, reports).
  • Behavior: strip trailing zeros after the decimal point; if the result ends in “.0” with no other fractional digits, the “.0” may be omitted entirely.
  • Non-destructive: stored values and underlying precision are untouched; this is purely a presentation-layer change.

Requested By: Muséum d’Histoire Naturelle Geneva and many others

Image

This should display as 15, not 15.000000000

Original Value Displayed Value Notes
3.7000000 3.7 Trailing zeros after the 7 are removed
3.0000000 3 Entire “.0” is dropped when no fraction
1234.56000 1,234.56 Grouping separator applied, zeros trimmed
0.0000 0 Zero with no remaining decimal places
0.120000 0.12 Leading zero kept, trailing zeros removed
–2.3400 –2.34 Negative value, zeros trimmed as usual

Original issue by @maxpatiiuk:

Need to make UI round all floats like 3.7000000 to 3.7 when displaying on the form.
This is most useful for the lat/long fields, but probably others too
It won't affect what's stored in the database.

See also #1208

Metadata

Metadata

Assignees

No one assigned

    Labels

    1 - RequestA request made by a member of the community2 - Exporting DataIssues that are related to exporting data to DwC, GBIF, IPT, Web Portal, etc.2 - QueriesIssues that are related to the query builder or queries in general2 - User InterfaceIssues that are related to the user interface or user experience.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions