Skip to content

Set unitSystem conversion #1282

@pvandriessche

Description

@pvandriessche

I'm trying to set a unitSystem for a Unit that was created in "Inch", when I call setUnitSystem('si') the unit system is corretly changed.
However when calling the format() the unit is still represented in Inch.
Is there a way to solve this?

This is the code

    var measure = math.unit("2 in")
    console.log(measure.formatUnits());
    //"in"
    measure.constructor.setUnitSystem("si");
    console.log("unit system :" + measure.constructor.getUnitSystem());
    // "unit system: si"
    console.log(measure.formatUnits());
    // "in" => should be "m"?

Thanks in advance!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions