Fix PM hours

master
Hank 2022-06-12 21:13:28 +02:00
parent 516814cdf8
commit 38f23be5b4
3 changed files with 6 additions and 15 deletions

View File

@ -1,4 +1,5 @@
0.15: Initial release - be patient as this is the first try :) 0.15: Initial release - be patient as this is the first try :)
0.16: Fix timing 0.16: Fix timing
0.17: Fix hours 0.17: Fix hours
0.18: Code cleanup and major changes with seconds timing. New feature: if watch is locked, seconds get refreshed every 10 seconds. 0.18: Code cleanup and major changes with seconds timing. New feature: if watch is locked, seconds get refreshed every 10 seconds.
0.19: Fix PM Hours

View File

@ -19,7 +19,6 @@ const font = "6x8";
/* TODO: we could totally use 'Layout' here and /* TODO: we could totally use 'Layout' here and
avoid a whole bunch of hard-coded offsets */ avoid a whole bunch of hard-coded offsets */
const xyCenter = g.getWidth() / 2; const xyCenter = g.getWidth() / 2;
const xyCenterSeconds = xyCenter + (big ? 85 : 68); const xyCenterSeconds = xyCenter + (big ? 85 : 68);
const yAmPm = xyCenter - (big ? 70 : 48); const yAmPm = xyCenter - (big ? 70 : 48);
@ -171,7 +170,8 @@ function draw() {
//do 12 hour stuff //do 12 hour stuff
if (hours > 12) { if (hours > 12) {
ampm = "PM"; ampm = "PM";
hours = hours - 12; hours = hours - 12;
if (hours < 10) hours = doublenum(hours);
} else { } else {
ampm = "AM"; ampm = "AM";
} }
@ -200,8 +200,6 @@ function draw() {
g.setFont("Vector", 17); g.setFont("Vector", 17);
g.drawString(require("locale").dow(new Date(), 1).toUpperCase() + ", " + localDate, xyCenter, yposDate, true); g.drawString(require("locale").dow(new Date(), 1).toUpperCase() + ", " + localDate, xyCenter, yposDate, true);
g.setFont(font, primaryDateFontSize); g.setFont(font, primaryDateFontSize);
// set gmt to UTC+0 // set gmt to UTC+0
var gmt = new Date(d.getTime() + d.getTimezoneOffset() * 60 * 1000); var gmt = new Date(d.getTime() + d.getTimezoneOffset() * 60 * 1000);
@ -345,12 +343,4 @@ Bangle.on('lock',on=>{
draw(); // draw immediately, queue redraw draw(); // draw immediately, queue redraw
updatePos(); updatePos();
} }
}); });

View File

@ -2,7 +2,7 @@
"id": "hworldclock", "id": "hworldclock",
"name": "Hanks World Clock", "name": "Hanks World Clock",
"shortName": "Hanks World Clock", "shortName": "Hanks World Clock",
"version": "0.18", "version": "0.19",
"description": "Current time zone plus up to three others", "description": "Current time zone plus up to three others",
"allow_emulator":true, "allow_emulator":true,
"icon": "app.png", "icon": "app.png",