03-25-2018 15:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-25-2018 15:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I could not find an answer to this problem and as I am not a very experienced programmer I was wondering how i can make my steps have a point or a comma. For example 10.256 steps or 10,256 steps. It's a lot nicer than just showing 10256 steps.
I have this code lblSteps.text = today.local.steps ; but not sure how to make it insert a . or , for steps over a thousand.
Thanks in advance for the help.
Kind regards
Answered! Go to the Best Answer.

Accepted Solutions
03-25-2018 15:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-25-2018 15:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
toLocaleString is the key I think ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleStri...)
Try something like
let stepsCount = today.local.steps ; lblSteps.text = stepsCount.toLocaleString("en-US");
Number representation being locale dependant. That opens an interesting question into localization support on fitbit OS.
03-25-2018 15:33 - edited 03-25-2018 15:54
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


03-25-2018 15:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-25-2018 15:53
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
toLocaleString is the key I think ( https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toLocaleStri...)
Try something like
let stepsCount = today.local.steps ; lblSteps.text = stepsCount.toLocaleString("en-US");
Number representation being locale dependant. That opens an interesting question into localization support on fitbit OS.
03-26-2018 00:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

03-26-2018 00:28
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks a lot, that did the trick =D!

05-19-2019 10:17 - edited 05-19-2019 14:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

05-19-2019 10:17 - edited 05-19-2019 14:18
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Edit this is actually working on the watch (but the parameter is ignored, the local formatting is always used)
This is actually not working for languages other than US it seems. It will only show "," regardless of the user preferences.
I'm also curious as to how formatting should be done. The Layers default watchface will correctly separate thousands according to the locale

