Skip to content
This repository was archived by the owner on Dec 8, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Countdown/Countdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ if (widgetInputRAW !== null) {
}
dateForCountdown = widgetInput[0].trim()
icon = widgetInput[1] || '⏳';
text = widgetInput[3]; // new
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please make this "optional" to avoid breaking changes: Use "Countdown" as fallback value in case there is no text defined

if (widgetInput[2] && widgetInput[2].toLowerCase() === 'true') {
showDate = true
}
Expand All @@ -26,9 +27,9 @@ if (widgetInputRAW !== null) {

////////////////////////////////////////////////////////////////////////////////
const localeText = {
default: ['Day', 'Days'],
en: ['Day', 'Days'],
de: ['Tag', 'Tage'],
default: ['Day', 'Days', 'weeks'],
en: ['Day', 'Days', 'Weeks'],
de: ['Tag', 'Tage', 'Wochen'],
fr: ['Jour', 'Jours'],
es: ['día', 'días'],
it: ['giorno', 'giorni']
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add "Weeks" also to fr, es, and it.

Expand All @@ -54,6 +55,7 @@ function getTimeRemaining(endtime){
};
}
let remainingDays = getTimeRemaining(dateForCountdown).days + 1;
let remainingWeeks = Math.round(remainingDays*10 /7)/10;

// Create Widget
let widget = new ListWidget();
Expand All @@ -69,7 +71,7 @@ gradient.colors = [
widget.backgroundGradient = gradient


let provider = widget.addText(icon + " Countdown")
let provider = widget.addText(icon + " " + text) // variant
provider.font = Font.mediumSystemFont(12)
provider.textColor = textColor

Expand Down Expand Up @@ -98,6 +100,11 @@ if (remainingDays === 1) {
}
postfixText.font = Font.regularSystemFont(20)
postfixText.textColor = textColor;
let provider2 = widget.addText(remainingWeeks+ " " + (t[2]))
provider2.font = Font.mediumSystemFont(16)
provider2.textColor = textColor
provider2.centerAlignText()
textStack.addSpacer()
Comment on lines +103 to +107
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • please use a separated horizontal stack with a spacer at beginning and end, and not the one from the remaining days (textStack).
  • Please make this part configurable, because maybe not everyone would like to see also the remaining weeks


textStack.addSpacer()

Expand Down