We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In the smart home display, 12 noon shows as 12am -- this should be 12 pm. The incorrect logic is in updateTimeStamp() in app.js.
A potential fix is to replace:
let suffix = 'am'; if (hours > 12) { hours -= 12; suffix = 'pm'; } else if (hours === 0) { hours = 12; }
With:
const suffix = (hours < 12) ? 'am': 'pm'; hours = hours % 12; hours = hours ? hours : 12; minutes = minutes < 10 ? '0' + minutes : minutes;
Another way to pad the minutes:
minutes = minutes.toString().padStart(2, '0');
Haven't checked whether you've got any JS version constraints or style guidelines, so apologies if any of this doesn't fit in!
Also note that an alternative to the whole function might be to use date.toLocaleTimeString with hour12 = true.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
In the smart home display, 12 noon shows as 12am -- this should be 12 pm. The incorrect logic is in updateTimeStamp() in app.js.
A potential fix is to replace:
With:
Another way to pad the minutes:
Haven't checked whether you've got any JS version constraints or style guidelines, so apologies if any of this doesn't fit in!
Also note that an alternative to the whole function might be to use date.toLocaleTimeString with hour12 = true.
The text was updated successfully, but these errors were encountered: