Add field formatter option to strip trailing zeroes

Created on 8 June 2017, over 7 years ago
Updated 15 August 2024, 5 months ago

Looking to get some feedback from maintainers/other users about adding configuration options to the field formatter. Our site has a number of weight fields in which we limit the value to an integer, so displaying them as "12 lb" or "12.0" lb would be better than the current default which has much more precision/decimals. Many ways to skin this cat but just wondering if that's not currently included on purpose, or if this would be entertained as part of the module.

πŸ“Œ Task
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bradjones1 Digital Nomad Life

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    I agree this makes sense, but is also related to a better number formatting in Drupal Core, I think, as this may even be locale-related plus context related? (Thousands separator, field context like industry, ...)

    Some time ago, we created https://www.drupal.org/project/advanced_number_format β†’ to track that need. So the question is, should the formatting be that specific to physical field or should there at least be a more central point for things like that. Maybe that could then be overridden in the field formatter...?

  • Status changed to Needs work 5 months ago
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @jonnyeom could you prepare the latest patch as MR please for easier review?

Production build 0.71.5 2024