08-09-2018 23:57 - edited 08-10-2018 00:06
08-09-2018 23:57 - edited 08-10-2018 00:06
Hello! I made a watch face and got and e-mail from a Fitbit user that AM and PM show incorrectly. PM was showing when it was Am and other way around. I fixed it (I think I fixed it) and asked the Fitbit user to update the watch face. She replied that everything works fine now.
But other user still has the same problem.
How is it possible that one person sees AM ja PM correctly and other does not. Am I missing something? Anybody have some kind of an idea? Does it have to do something with a region?
My code:
const myLabel = document.getElementById("myLabel");
const amPm = document.getElementById("amPm");
clock.ontick = (evt) =>
{
let todayD = evt.date;
let hours = todayD.getHours();
let sec = todayD.getSeconds();
var ampm = " ";
if (preferences.clockDisplay === "12h")
{ hours = hours % 12 || 12;
var ampm = hours >= 12 ? 'pm' : 'am';} // 12h format
else
{ hours = util.zeroPad(hours); }
let mins = util.zeroPad(todayD.getMinutes());// 24h format
myLabel.text = `${hours}:${mins}`;
amPm.text = `${ampm}`;
}
Answered! Go to the Best Answer.
08-12-2018 03:44
08-12-2018 03:44
Thanks fir the reply. I actually think it is fixed. I had to eliminate “var” for infront of the ampm. But I’m still teating it out
08-12-2018 03:28
08-12-2018 03:28
Try moving the assignment of ampm before the %12 statement. Alternatively, use a new variable such as DisplayHours. Either way, you need to test the unadjusted hours being less than 12.
08-12-2018 03:44
08-12-2018 03:44
Thanks fir the reply. I actually think it is fixed. I had to eliminate “var” for infront of the ampm. But I’m still teating it out