forked from FOSS/BangleApps
Minor fixes
parent
4a6d5172b6
commit
165c3ef042
|
@ -8,3 +8,4 @@
|
|||
0.22: Use default Bangle formatter for booleans
|
||||
0.23: Added note to configure position in "my location" if not done yet. Small fixes.
|
||||
0.24: Added fast load
|
||||
0.25: Minor code optimization
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
{ // must be inside our own scope here so that when we are unloaded everything disappears
|
||||
|
||||
// ------- Settings file
|
||||
const SETTINGSFILE = "hworldclock.json";
|
||||
var secondsMode;
|
||||
|
@ -153,15 +155,15 @@ function updatePos() {
|
|||
|
||||
function drawSeconds() {
|
||||
// get date
|
||||
var d = new Date();
|
||||
var da = d.toString().split(" ");
|
||||
let d = new Date();
|
||||
let da = d.toString().split(" ");
|
||||
|
||||
// default draw styles
|
||||
g.reset().setBgColor(g.theme.bg).setFontAlign(0, 0);
|
||||
|
||||
// draw time
|
||||
var time = da[4].split(":");
|
||||
var seconds = time[2];
|
||||
let time = da[4].split(":");
|
||||
let seconds = time[2];
|
||||
|
||||
g.setFont("5x9Numeric7Seg",primaryTimeFontSize - 3);
|
||||
if (g.theme.dark) {
|
||||
|
@ -184,15 +186,15 @@ function drawSeconds() {
|
|||
|
||||
function draw() {
|
||||
// get date
|
||||
var d = new Date();
|
||||
var da = d.toString().split(" ");
|
||||
let d = new Date();
|
||||
let da = d.toString().split(" ");
|
||||
|
||||
// default draw styles
|
||||
g.reset().setBgColor(g.theme.bg).setFontAlign(0, 0);
|
||||
|
||||
// draw time
|
||||
var time = da[4].split(":");
|
||||
var hours = time[0],
|
||||
let time = da[4].split(":");
|
||||
let hours = time[0],
|
||||
minutes = time[1];
|
||||
|
||||
|
||||
|
@ -223,7 +225,7 @@ function draw() {
|
|||
// am / PM ?
|
||||
if (_12hour){
|
||||
//do 12 hour stuff
|
||||
//var ampm = require("locale").medidian(new Date()); Not working
|
||||
//let ampm = require("locale").medidian(new Date()); Not working
|
||||
g.setFont("Vector", 17);
|
||||
g.drawString(ampm, xyCenterSeconds, yAmPm, true);
|
||||
}
|
||||
|
@ -232,14 +234,14 @@ function draw() {
|
|||
|
||||
// draw Day, name of month, Date
|
||||
//DATE
|
||||
var localDate = require("locale").date(new Date(), 1);
|
||||
let localDate = require("locale").date(new Date(), 1);
|
||||
localDate = localDate.substring(0, localDate.length - 5);
|
||||
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);
|
||||
let gmt = new Date(d.getTime() + d.getTimezoneOffset() * 60 * 1000);
|
||||
|
||||
// Loop through offset(s) and render
|
||||
offsets.forEach((offset, index) => {
|
||||
|
@ -249,7 +251,7 @@ function draw() {
|
|||
|
||||
|
||||
if (offsets.length === 1) {
|
||||
var date = [require("locale").dow(new Date(), 1), require("locale").date(new Date(), 1)];
|
||||
let date = [require("locale").dow(new Date(), 1), require("locale").date(new Date(), 1)];
|
||||
// For a single secondary timezone, draw it bigger and drop time zone to second line
|
||||
const xOffset = 30;
|
||||
g.setFont(font, secondaryTimeFontSize).drawString(`${hours}:${minutes}`, xyCenter, yposTime2, true);
|
||||
|
@ -317,7 +319,7 @@ draw();
|
|||
|
||||
if (!Bangle.isLocked()) { // Initial state
|
||||
if (showSunInfo) {
|
||||
if (PosInterval != 0) clearInterval(PosInterval);
|
||||
if (PosInterval != 0 && typeof PosInterval != undefined) clearInterval(PosInterval);
|
||||
PosInterval = setInterval(updatePos, 60*10E3); // refesh every 10 mins
|
||||
updatePos();
|
||||
}
|
||||
|
@ -343,7 +345,7 @@ if (!Bangle.isLocked()) { // Initial state
|
|||
drawTimeout = undefined;
|
||||
|
||||
if (showSunInfo) {
|
||||
if (PosInterval != 0) clearInterval(PosInterval);
|
||||
if (PosInterval != 0 && typeof PosInterval != undefined) clearInterval(PosInterval);
|
||||
PosInterval = setInterval(updatePos, 60*60E3); // refesh every 60 mins
|
||||
updatePos();
|
||||
}
|
||||
|
@ -388,4 +390,5 @@ Bangle.on('lock',on=>{
|
|||
}
|
||||
draw(); // draw immediately, queue redraw
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"id": "hworldclock",
|
||||
"name": "Hanks World Clock",
|
||||
"shortName": "Hanks World Clock",
|
||||
"version": "0.24",
|
||||
"version": "0.25",
|
||||
"description": "Current time zone plus up to three others",
|
||||
"allow_emulator":true,
|
||||
"icon": "app.png",
|
||||
|
|
Loading…
Reference in New Issue