diff --git a/apps/boxclk/ChangeLog b/apps/boxclk/ChangeLog index 591d880b8..65a6c979f 100644 --- a/apps/boxclk/ChangeLog +++ b/apps/boxclk/ChangeLog @@ -12,4 +12,5 @@ - [+] Fixed optional seconds not displaying in time - [+] Fixed drag handler by adding E.stopEventPropagation() - [+] General code optimization and cleanup -0.09: Revised event handler code \ No newline at end of file +0.09: Revised event handler code +0.10: Revised suffix formatting in getDate function \ No newline at end of file diff --git a/apps/boxclk/app.js b/apps/boxclk/app.js index 87bbcef77..71dbda94f 100644 --- a/apps/boxclk/app.js +++ b/apps/boxclk/app.js @@ -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) { diff --git a/apps/boxclk/boxclk-2.json b/apps/boxclk/boxclk-2.json index dde1da97e..1bdc89252 100644 --- a/apps/boxclk/boxclk-2.json +++ b/apps/boxclk/boxclk-2.json @@ -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": "%" diff --git a/apps/boxclk/metadata.json b/apps/boxclk/metadata.json index c8790fe7f..48f9f82ae 100644 --- a/apps/boxclk/metadata.json +++ b/apps/boxclk/metadata.json @@ -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" }, diff --git a/apps/boxclk/screenshot-2.png b/apps/boxclk/screenshot-2.png index 568a310b9..361185406 100644 Binary files a/apps/boxclk/screenshot-2.png and b/apps/boxclk/screenshot-2.png differ