josdejong / josdejong/mathjs

Set unitSystem conversion

Open
#1,282 3 comments 0 reactions 1 assignee Claimed by @ericman314 View on GitHub
Dominant language
JavaScript
Stars
15.1k
Forks
1.3k
PR merge metrics
No merged PRs in 30d

Description

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
```js
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!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.