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

Formatting options #140

Closed
markusjohnsson opened this issue Aug 5, 2019 · 4 comments · Fixed by #141
Closed

Formatting options #140

markusjohnsson opened this issue Aug 5, 2019 · 4 comments · Fixed by #141

Comments

@markusjohnsson
Copy link

This seams like a very useful library and I've been toying with it a bit.

I was wondering if there are more formatting options, corresponding to toFixed and toPrecision. I was using the lib in a react application and wanted to some simple unit conversion for display, but I got this, which is not really suitable for display.

<span>{distance.in(kilo(meters))}</span> // "29.023945563497445 km"

Is there another way to do this or is it a limitation?

@jscheiny
Copy link
Owner

jscheiny commented Aug 6, 2019

Good note, I definitely meant to include the ability to format measures at some point but it slipped my mind. I have a concept for the API for this and will create a PR soon.

@markusjohnsson
Copy link
Author

Great to hear!

Just a little note: I was fiddling with some formatting code myself and I quickly found that for any Time measures in the order of minutes and hours, I really prefer to have HH:mm:ss rather than decimal formatting. I don't know if that is part of your plan since it is specific for the Time dimension; but I think I might not be the only one wanting this.

@jscheiny
Copy link
Owner

jscheiny commented Aug 9, 2019

Just opened up a PR, would love to hear your thoughts on the API.

With respect to time formatting I'm a little torn on if I think this library should handle it and if so, how. Will give it some more thought but its a good suggestion regardless.

@jscheiny
Copy link
Owner

jscheiny commented Nov 8, 2019

This has been released in v1.1.0!

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

Successfully merging a pull request may close this issue.

2 participants