diff options
| -rwxr-xr-x | wetter | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -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" \ |
