mirror of https://github.com/espruino/BangleApps
Merge branch 'master' of github.com:espruino/BangleApps
commit
20c4f06718
|
@ -17,4 +17,5 @@
|
|||
0.17: Fix - Step count was no more shown in the menu.
|
||||
0.18: Set timer for an agenda entry by simply clicking in the middle of the screen. Only one timer can be set.
|
||||
0.19: Fix - Compatibility with "Digital clock widget"
|
||||
0.20: Better handling of async data such as getPressure.
|
||||
0.20: Better handling of async data such as getPressure.
|
||||
0.21: On the default menu the week of year can be shown.
|
|
@ -198,6 +198,7 @@ function imgMountain() {
|
|||
var menu = [
|
||||
[
|
||||
function(){ return [ null, null ] },
|
||||
function(){ return [ "Week " + weekOfYear(), null ] },
|
||||
],
|
||||
[
|
||||
function(){ return [ "Bangle", imgWatch() ] },
|
||||
|
@ -423,6 +424,19 @@ function getWeather(){
|
|||
};
|
||||
}
|
||||
|
||||
// From https://weeknumber.com/how-to/javascript
|
||||
function weekOfYear() {
|
||||
var date = new Date();
|
||||
date.setHours(0, 0, 0, 0);
|
||||
// Thursday in current week decides the year.
|
||||
date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7);
|
||||
// January 4 is always in week 1.
|
||||
var week1 = new Date(date.getFullYear(), 0, 4);
|
||||
// Adjust to Thursday in week 1 and count number of weeks from date to week1.
|
||||
return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000
|
||||
- 3 + (week1.getDay() + 6) % 7) / 7);
|
||||
}
|
||||
|
||||
|
||||
function isAlarmEnabled(idx){
|
||||
try{
|
||||
|
@ -600,7 +614,7 @@ function drawTime(){
|
|||
}
|
||||
|
||||
var imgWidth = 0;
|
||||
if(menuImg !== undefined){
|
||||
if(menuImg){
|
||||
imgWidth = 24.0;
|
||||
var strWidth = g.stringWidth(menuText);
|
||||
var scale = imgWidth / menuImg.width;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "bwclk",
|
||||
"name": "BW Clock",
|
||||
"version": "0.20",
|
||||
"version": "0.21",
|
||||
"description": "A very minimalistic clock to mainly show date and time.",
|
||||
"readme": "README.md",
|
||||
"icon": "app.png",
|
||||
|
|
Loading…
Reference in New Issue