01-12-2020 00:18
01-12-2020 00:18
I have made a clock face which appears fine in the simulator on the Ionic and all models of Versa including Versa 2. I build with SDK 4.1. Every week or so I get a support mail from Versa users saying they have installed the clock and the Hour is frozen at 12. And its always users in the US. I have tried changing time zone and location on my companion app and on the simulator to see if this has an effect but I cannot reproduce the issue. I suspect some other variable somewhere is causing the hour update not to work. Has anyone come across this issue with other clocks?
Answered! Go to the Best Answer.
01-14-2020 10:44
01-14-2020 10:44
There's nothing specifically wrong with that line of code, unless you don't have the `hours` variable already defined, or it's not a number, or something?
01-14-2020 05:51
01-14-2020 05:51
01-14-2020 06:51
01-14-2020 06:51
Hi Thanks for the offer - here is the link:
https://gallery.fitbit.com/details/b4302870-c440-4229-a1c1-6d4d7440c51e
But I think I spotted it - I was using a line of code from a sample clock that seemed to cause the issue. I changed my time format on my online profile to 12 hour instead of 24 hour and immediately got the problem. Removed the below line of code and all worked properly. Would still be grateful if you can test and see if it really is fixed though. This is the offending line of code taken from jonFitbit's sample clock on github:
hours = hours % 12 || 12;
01-14-2020 10:44
01-14-2020 10:44
There's nothing specifically wrong with that line of code, unless you don't have the `hours` variable already defined, or it's not a number, or something?
01-14-2020 12:41
01-14-2020 12:41
Thanks, that gave me a bit of a clue. Its not the line of code itself but rather the processing I do on the hours value to format it. I now do that after I test for the 12 hour clock preference and its now correct in the simulator in 12h format.