From 38f23be5b4b9da4726eb53bcffd716766a5aa4d4 Mon Sep 17 00:00:00 2001 From: Hank Date: Sun, 12 Jun 2022 21:13:28 +0200 Subject: [PATCH] Fix PM hours --- apps/hworldclock/ChangeLog | 3 ++- apps/hworldclock/app.js | 16 +++------------- apps/hworldclock/metadata.json | 2 +- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/apps/hworldclock/ChangeLog b/apps/hworldclock/ChangeLog index 30d729cbf..fdc717c92 100644 --- a/apps/hworldclock/ChangeLog +++ b/apps/hworldclock/ChangeLog @@ -1,4 +1,5 @@ 0.15: Initial release - be patient as this is the first try :) 0.16: Fix timing 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. \ No newline at end of file +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 \ No newline at end of file diff --git a/apps/hworldclock/app.js b/apps/hworldclock/app.js index 6101d4427..e907dd703 100644 --- a/apps/hworldclock/app.js +++ b/apps/hworldclock/app.js @@ -19,7 +19,6 @@ const font = "6x8"; /* TODO: we could totally use 'Layout' here and avoid a whole bunch of hard-coded offsets */ - const xyCenter = g.getWidth() / 2; const xyCenterSeconds = xyCenter + (big ? 85 : 68); const yAmPm = xyCenter - (big ? 70 : 48); @@ -171,7 +170,8 @@ function draw() { //do 12 hour stuff if (hours > 12) { ampm = "PM"; - hours = hours - 12; + hours = hours - 12; + if (hours < 10) hours = doublenum(hours); } else { ampm = "AM"; } @@ -200,8 +200,6 @@ function draw() { g.setFont("Vector", 17); g.drawString(require("locale").dow(new Date(), 1).toUpperCase() + ", " + localDate, xyCenter, yposDate, true); - - g.setFont(font, primaryDateFontSize); // set gmt to UTC+0 var gmt = new Date(d.getTime() + d.getTimezoneOffset() * 60 * 1000); @@ -345,12 +343,4 @@ Bangle.on('lock',on=>{ draw(); // draw immediately, queue redraw updatePos(); } - }); - - - - - - - - + }); \ No newline at end of file diff --git a/apps/hworldclock/metadata.json b/apps/hworldclock/metadata.json index 9eb95a0ed..1ee04b333 100644 --- a/apps/hworldclock/metadata.json +++ b/apps/hworldclock/metadata.json @@ -2,7 +2,7 @@ "id": "hworldclock", "name": "Hanks World Clock", "shortName": "Hanks World Clock", - "version": "0.18", + "version": "0.19", "description": "Current time zone plus up to three others", "allow_emulator":true, "icon": "app.png",