I think I've found a bug with the Number.prototype.toFixed() method. It can be reproduced in Fitbit Studio by starting a new project with the Minimal template, and putting this in app/index.js:
let fixed = Number(0.1).toFixed(3)
console.log(`${fixed} <-- expected 0.100 here `)What actually gets logged to the console is:
0.1
Note that there are two abnormalities here:
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
I can confirm that this bug is still there in latest version (27.32.10.20) of Ionic. However, the bug is not present in Fitbit OS Simulator.
Testing on Ionic
index.js
console.log("91:" + parseFloat(91).toFixed(1));
console.log("91.0:" + parseFloat(91.0).toFixed(1));
console.log("91.5:" + parseFloat(91.5).toFixed(1));
console.log("'91':" + parseFloat("91").toFixed(1));
console.log("'91.0':" + parseFloat("91.0").toFixed(1));
console.log("'91.5':" + parseFloat("91.5").toFixed(1));Console
91: 91. 91.0: 91. 91.5: 91.0 '91': 91. '91.0': 91. '91.5': 91.0
Testing on Fitbit OS Simulator
Console
91: 91.0 91.0: 91.0 91.5: 91.5 '91': 91.0 '91.0': 91.0 '91.5': 91.5
Best Answer