Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pretty unit output #139

Open
carlo-quinonez opened this issue Jul 25, 2023 · 0 comments
Open

Pretty unit output #139

carlo-quinonez opened this issue Jul 25, 2023 · 0 comments

Comments

@carlo-quinonez
Copy link

carlo-quinonez commented Jul 25, 2023

How can we generate a pretty quantity (eg.96 °C, 10 µA) from a Qty? js-quantities has an API for formatting output, including specifying custom formatter functions, but this formatting seems to be concerned with the number rather than the unit.

Our team is developing a tool to monitor the health of instruments sold by our customers. Basically, instruments installed at customer site report back low-level telemetry like fan speeds, temperatures, power, etc. We use js-quantities in several places, including in the dashboards (single page webapps) to display the data in a preferred unit. For example, the instruments might transmit a property as 0.001238 amps but we display as 1.2 µA. We use js-quantitites to do the conversion and rounding, and then handle the unit itself in our code.

However, we need to display pretty quanties in more places than one product so we're consider writing a module to handle prettifying the unit. Has a "pretty units" feature ever been for js-quantities? Would a PR be welcomed adding this feature?

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

No branches or pull requests

1 participant