12-26-2017 20:28
12-26-2017 20:28
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:
01-09-2018 16:35
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.
01-09-2018 16:35
Looks like the fix for this missed the release! It should be included in the next update! Thanks for raising this.
06-07-2018 12:34 - edited 06-07-2018 13:18
06-07-2018 12:34 - edited 06-07-2018 13:18
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