10-25-2017 06:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
10-25-2017 06:14
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Is toLocaleString() supported? I got the current locale from user-settings with locale.language and I tried to localise the date with toLocaleString(), but it didn't work.
How is the date localised in the Fitbit-watchfaces?
Answered! Go to the Best Answer.

- Labels:
-
JavaScript
Accepted Solutions
11-14-2017 13:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


11-14-2017 13:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Sorry, the device only support ES 5.1 JavaScript, and toLocaleDateString() doesn't support the formatting options in this version.

11-09-2017 11:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-09-2017 11:31
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I was wondering the same thing. I am able to use toLocaleString() to get commas to appear in my numbers that are greater than 1,000; but date.toLocaleDateString("en-us", { 'weekday': "short" })) and date.toLocaleDateString("en-us", { 'month': "short" }) always returns the date in year-month-day format.

11-12-2017 12:56
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
11-12-2017 12:56
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Any news on this?
We should localise our apps and watchfaces for publication, so, how should this be done, if .toLocaleDateString() is not supported?
My solution is working, but not very elegant...
I haven't found anything about localisation in the documentation, so please help...

11-14-2017 13:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


11-14-2017 13:15
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Sorry, the device only support ES 5.1 JavaScript, and toLocaleDateString() doesn't support the formatting options in this version.

11-01-2022 13:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-01-2022 13:22
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Is there a work-around? I want to display the time in HH:MM but not military time. I can slice off the seconds, but I really want 12-hour time.

11-01-2022 13:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


11-01-2022 13:57
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
If you've got a Date object, you should be able to use most of the functions listed here.
Gondwana Software

11-02-2022 03:24
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
11-02-2022 03:24
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
I think
hours %= 12
should do what you want.
11-02-2022 10:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-02-2022 10:19
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Thanks!
Note that if (hours == 12) hours %= 12 returns 0, so
hours = ((hours %= 12) ? 0 : 12);

11-02-2022 10:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
11-02-2022 10:35
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Does this work?
I'd have thought
hours = hours === 12 ? hours : hours%12;

11-02-2022 13:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-02-2022 13:40
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
things like "===" don't spring to mind yet. Thanks for your help!

11-02-2022 15:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


11-02-2022 15:10
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
(hours+11)%12+1
Gondwana Software
11-02-2022 15:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

SunsetRunner
11-02-2022 15:21
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
So midnight isn't 0 but 12 in 12h format? I didn't know that! 🙈😅

11-03-2022 10:18 - edited 11-03-2022 11:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-03-2022 10:18 - edited 11-03-2022 11:45
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
I see now that Versa 2 has a different OS than Versa 3, so i retract my question. Sorry.

