Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

AM & PM showing differently for different people

ANSWERED

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}`;
}

 

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

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

View best answer in original post

Best Answer
0 Votes
2 REPLIES 2

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. 

Best Answer
0 Votes

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

Best Answer
0 Votes