Skip to content

Unexpected formatting of formatted output for converted weight #138

Description

@donaldpiret

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions