mirror of https://github.com/espruino/BangleApps
Show month short or long using "shortMonth"
parent
8eec699370
commit
ecb2013ac4
|
@ -1,2 +1,3 @@
|
|||
0.01: New App!
|
||||
0.02: New config options such as step, meridian, short/long formats, custom prefix/suffix
|
||||
0.03: Allows showing the month in short or long format by setting `"shortMonth"` to true or false
|
||||
|
|
|
@ -39,6 +39,7 @@ Here's what an example configuration might look like:
|
|||
"suffix": "", // Adds a string to the end of the main string
|
||||
"disableSuffix": true, // Use to remove DayOfMonth suffix only
|
||||
"short": false // Use long format of time, meridian, date, or DoW
|
||||
"shortMonth": false // Use long format of month within date
|
||||
|
||||
},
|
||||
"bg": { // Can also be removed for no background
|
||||
|
@ -75,9 +76,11 @@ __Breakdown of Parameters:__
|
|||
|
||||
* **suffix:** Adds a string to the end of the main string. For example, you can set "suffix": "%" to display "80%" for the battery percentage.
|
||||
|
||||
* **disableSuffix:** Applies only to the "date" box. Set to true to disable the DayOfMonth suffix. This is used to remove the "st","nd","rd", or "th" from the DayOfMonth number
|
||||
* **disableSuffix:** Applies only to the "date" box. Set to true to disable the DayOfMonth suffix. This is used to remove the "st","nd","rd", or "th" from the DayOfMonth number.
|
||||
|
||||
* **short:** Set to false to get the long format value of time, meridian, date, or DayOfWeek. Short formats are used by default,
|
||||
* **short:** Set to false to get the long format value of time, meridian, date, or DayOfWeek. Short formats are used by default if not specified.
|
||||
|
||||
* **shortMonth:** Set to false to get the long format value of the month. Short format is used by default if not specified.
|
||||
|
||||
* **bg:** This specifies a custom background image, with the img property defining the name of the image file on the Bangle.js storage.
|
||||
|
||||
|
|
|
@ -171,10 +171,10 @@
|
|||
return typeof val !== 'undefined' ? Boolean(val) : defaultVal;
|
||||
};
|
||||
|
||||
let getDate = function(short, disableSuffix) {
|
||||
let getDate = function(short, shortMonth, disableSuffix) {
|
||||
const date = new Date();
|
||||
const dayOfMonth = date.getDate();
|
||||
const month = short ? locale.month(date, 0) : locale.month(date, 1);
|
||||
const month = shortMonth ? locale.month(date, 1) : locale.month(date, 0);
|
||||
const year = date.getFullYear();
|
||||
let suffix;
|
||||
if ([1, 21, 31].includes(dayOfMonth)) {
|
||||
|
@ -228,7 +228,12 @@
|
|||
boxes.meridian.string = modString(boxes.meridian, locale.meridian(date, isBool(boxes.meridian.short, true)));
|
||||
}
|
||||
if (boxes.date) {
|
||||
boxes.date.string = modString(boxes.date, getDate(isBool(boxes.date.short, true), isBool(boxes.date.disableSuffix, false)));
|
||||
boxes.date.string = (
|
||||
modString(boxes.date,
|
||||
getDate(isBool(boxes.date.short, true),
|
||||
isBool(boxes.date.shortMonth, true),
|
||||
isBool(boxes.date.disableSuffix, false)
|
||||
)));
|
||||
}
|
||||
if (boxes.dow) {
|
||||
boxes.dow.string = modString(boxes.dow, getDayOfWeek(date, isBool(boxes.dow.short, true)));
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "boxclk",
|
||||
"name": "Box Clock",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "A customizable clock with configurable text boxes that can be positioned to show your favorite background",
|
||||
"icon": "app.png",
|
||||
"screenshots": [
|
||||
|
|
Loading…
Reference in New Issue