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
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
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:
Requested By: Muséum d’Histoire Naturelle Geneva and many others
This should display as
15, not15.000000000Original issue by @maxpatiiuk: