From 865e78a0877dd10f4736a7bdb721aa9448647d8d Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 4 Aug 2026 20:00:09 +0200 Subject: admit WETTER_DAYS --- wetter | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wetter b/wetter index 6f5ac19..fb89ac0 100755 --- a/wetter +++ b/wetter @@ -14,6 +14,9 @@ # # WETTER_API_ROOT_URL # WETTER_TOKEN_URL +# WETTER_DAYS +# How many days of weather to show. +# Default: 4 # # WETTER_LOCATION # @@ -64,11 +67,13 @@ main() { locatedAt=$(echo "$location_spec" | awk -F, '{print$2","$1}') + days=${WETTER_DAYS-4} + validFrom=$(date -d 'TZ="Europe/Berlin" - 48 hours' --utc +'%Y-%m-%dT%H:%M:%S.%3NZ') - validUntil=$(date -d "TZ=\"Europe/Berlin\" + $(( 5 * 24 )) hours" --utc +'%Y-%m-%dT%H:%M:%S.%3NZ') + validUntil=$(date -d 'TZ="Europe/Berlin" + '$(( ( days + 1 ) * 24 ))' hours' --utc +'%Y-%m-%dT%H:%M:%S.%3NZ') t0=$(date -d 'TZ="Europe/Berlin" - 0 days 00:00' +'%Y-%m-%dT%H:%M:%S.%3NZ') - t1=$(date -d 'TZ="Europe/Berlin" + 4 days 00:00' +'%Y-%m-%dT%H:%M:%S.%3NZ') + t1=$(date -d 'TZ="Europe/Berlin" + '"$days"' days 00:00' +'%Y-%m-%dT%H:%M:%S.%3NZ') curl -fsS \ -H "authorization: Bearer $token" \ -- cgit v1.3.1