mirror of https://github.com/espruino/BangleApps
commit
c5fbfa4482
|
@ -13,3 +13,4 @@
|
|||
- [+] Fixed drag handler by adding E.stopEventPropagation()
|
||||
- [+] General code optimization and cleanup
|
||||
0.09: Revised event handler code
|
||||
0.10: Revised suffix formatting in getDate function
|
|
@ -208,12 +208,23 @@
|
|||
// 7. String forming helper functions
|
||||
let getDate = function(short, shortMonth, disableSuffix) {
|
||||
const date = new Date();
|
||||
const dayOfMonth = date.getDate();
|
||||
const day = date.getDate();
|
||||
const month = shortMonth ? locale.month(date, 1) : locale.month(date, 0);
|
||||
const year = date.getFullYear();
|
||||
let suffix = ["st", "nd", "rd"][(dayOfMonth - 1) % 10] || "th";
|
||||
let dayOfMonthStr = disableSuffix ? dayOfMonth : `${dayOfMonth}${suffix}`;
|
||||
return `${month} ${dayOfMonthStr}${short ? '' : `, ${year}`}`;
|
||||
|
||||
const getSuffix = (day) => {
|
||||
if (day >= 11 && day <= 13) return 'th';
|
||||
const lastDigit = day % 10;
|
||||
switch (lastDigit) {
|
||||
case 1: return 'st';
|
||||
case 2: return 'nd';
|
||||
case 3: return 'rd';
|
||||
default: return 'th';
|
||||
}
|
||||
};
|
||||
|
||||
const dayStr = disableSuffix ? day : `${day}${getSuffix(day)}`;
|
||||
return `${month} ${dayStr}${short ? '' : `, ${year}`}`; // not including year for short version
|
||||
};
|
||||
|
||||
let getDayOfWeek = function(date, short) {
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
"xOffset": 3,
|
||||
"yOffset": 0,
|
||||
"boxPos": {
|
||||
"x": "0.494",
|
||||
"x": "0.5",
|
||||
"y": "0.739"
|
||||
}
|
||||
},
|
||||
"dow": {
|
||||
"font": "6x8",
|
||||
"fontSize": 3,
|
||||
"outline": 1,
|
||||
"outline": 2,
|
||||
"color": "bgH",
|
||||
"outlineColor": "fg",
|
||||
"border": "#f0f",
|
||||
|
@ -27,7 +27,7 @@
|
|||
"xOffset": 2,
|
||||
"yOffset": 0,
|
||||
"boxPos": {
|
||||
"x": "0.421",
|
||||
"x": "0.5",
|
||||
"y": "0.201"
|
||||
},
|
||||
"short": false
|
||||
|
@ -35,7 +35,7 @@
|
|||
"date": {
|
||||
"font": "6x8",
|
||||
"fontSize": 2,
|
||||
"outline": 1,
|
||||
"outline": 2,
|
||||
"color": "bgH",
|
||||
"outlineColor": "fg",
|
||||
"border": "#f0f",
|
||||
|
@ -44,7 +44,7 @@
|
|||
"xOffset": 1,
|
||||
"yOffset": 0,
|
||||
"boxPos": {
|
||||
"x": "0.454",
|
||||
"x": "0.5",
|
||||
"y": "0.074"
|
||||
},
|
||||
"shortMonth": false,
|
||||
|
@ -62,7 +62,7 @@
|
|||
"xOffset": 2,
|
||||
"yOffset": 1,
|
||||
"boxPos": {
|
||||
"x": "0.494",
|
||||
"x": "0.5",
|
||||
"y": "0.926"
|
||||
},
|
||||
"prefix": "Steps: "
|
||||
|
@ -79,7 +79,7 @@
|
|||
"xOffset": 2,
|
||||
"yOffset": 2,
|
||||
"boxPos": {
|
||||
"x": "0.805",
|
||||
"x": "0.8",
|
||||
"y": "0.427"
|
||||
},
|
||||
"suffix": "%"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "boxclk",
|
||||
"name": "Box Clock",
|
||||
"version": "0.09",
|
||||
"version": "0.10",
|
||||
"description": "A customizable clock with configurable text boxes that can be positioned to show your favorite background",
|
||||
"icon": "app.png",
|
||||
"dependencies" : { "clockbg":"module" },
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 11 KiB |
Loading…
Reference in New Issue