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

Unexpected formatting of formatted output for converted weight #138

Open
donaldpiret opened this issue Feb 16, 2021 · 0 comments
Open

Unexpected formatting of formatted output for converted weight #138

donaldpiret opened this issue Feb 16, 2021 · 0 comments

Comments

@donaldpiret
Copy link

Hello,
I'm running into a bit of an unexpected behaviour with the following code:

weight = Measured::Weight.new(value, 'kg')
weight = weight.convert_to('lbs') if current_user&.prefers_imperial?
return weight.format('%.2<value>f %<unit>s')

Now I'd expect to just see this either in KG or LBS based on the user's preferences, but instead when the weight is converted, format gives me the full conversion string for the unit, eg. 319.67 lb (45359237/100000000 kg)
How do I get around this?

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