Oder mit Skript...
// Datum für Wetter Widget in der richtigen Reihenfolge anzeigen
createState("javascript.0.Wetter.Datum_ 1Tag", {name: 'Datum_ 1Tag', common: 'string'}, function () {})
createState("javascript.0.Wetter.Datum_ 2Tag", {name: 'Datum_ 2Tag', common: 'string'}, function () {})
createState("javascript.0.Wetter.Datum_ 3Tag", {name: 'Datum_ 3Tag', common: 'string'}, function () {})
createState("javascript.0.Wetter.Datum_ 4Tag", {name: 'Datum_ 4Tag', common: 'string'}, function () {})
createState("javascript.0.Wetter.Datum_ 5Tag", {name: 'Datum_ 5Tag', common: 'string'}, function () {})
createState("javascript.0.Wetter.Datum_ 6Tag", {name: 'Datum_ 6Tag', common: 'string'}, function () {})
createState("javascript.0.Wetter.Datum_ 7Tag", {name: 'Datum_ 7Tag', common: 'string'}, function () {})
function berechneDatum() {
function addDays(date, days) {
let result = new Date(date)
result.setDate(result.getDate() + days)
return result
}
function toDateString(date) {
let day = date.getDate() < 10 ? `0${date.getDate()}` : date.getDate()
let month = ["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"][date.getMonth()]
return `${day} ${month} ${date.getFullYear()}`
}
let currentDate = new Date()
let day01 = currentDate /* = addDays(currentDate, 0) */
let day02 = addDays(currentDate, 1)
let day03 = addDays(currentDate, 2)
let day04 = addDays(currentDate, 3)
let day05 = addDays(currentDate, 4)
let day06 = addDays(currentDate, 5)
let day07 = addDays(currentDate, 6)
setState("javascript.0.Wetter.Datum_ 1Tag", toDateString(day01))
setState("javascript.0.Wetter.Datum_ 2Tag", toDateString(day02))
setState("javascript.0.Wetter.Datum_ 3Tag", toDateString(day03))
setState("javascript.0.Wetter.Datum_ 4Tag", toDateString(day04))
setState("javascript.0.Wetter.Datum_ 5Tag", toDateString(day05))
setState("javascript.0.Wetter.Datum_ 6Tag", toDateString(day06))
setState("javascript.0.Wetter.Datum_ 7Tag", toDateString(day07))
}
berechneDatum() // Skriptstart
schedule("25 0 0 * * *", berechneDatum)
Screenshot 2024-12-28 141642.png