diff --git a/fhem/CHANGED b/fhem/CHANGED index 1d0681f05..d3022e9e2 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Do not insert empty lines here, update check depends on it. + - feature: 57_Calender: limit specification when=... amended - change: 10_MQTT_BRIDGE: Move to deprecated - feature: 98_weekprofile: add userattr 'weekprofile' to supported modules - change: 98_weekprofile: using id's in module documentation diff --git a/fhem/FHEM/57_Calendar.pm b/fhem/FHEM/57_Calendar.pm index d49858f4d..d64f47d0a 100644 --- a/fhem/FHEM/57_Calendar.pm +++ b/fhem/FHEM/57_Calendar.pm @@ -2077,16 +2077,24 @@ sub Calendar_Get($@) { for my $limit (@limits) { if($limit =~ /count=([1-9]+\d*)/) { $count= $1; - } elsif($limit =~ /when=(today|tomorrow)/i) { - my ($from,$to); + } elsif($limit =~ /^when=(today|tomorrow|(-?\d+)(..(-?\d+))?)$/i) { + my ($from,$to,$d1,$d2); if (lc($1) eq 'today') { - $from = Calendar_GetSecondsFromMidnight(); - $to = DAYSECONDS - $from - 1; - $from *= -1; + $d1= 0; + $d2= 0; + } elsif(lc($1) eq 'tomorrow') { + $d1= 1; + $d2= 1; } else { - $from = DAYSECONDS - Calendar_GetSecondsFromMidnight(); - $to = $from + DAYSECONDS - 1; + $d1= $2; + $d2= $d1; + if($4 ne '') { + $d2= $4; + } + ($d1,$d2)= ($d2,$d1) if($d1> $d2); } + $from = $d1*DAYSECONDS - Calendar_GetSecondsFromMidnight(); + $to = $from + ($d2-$d1+1)*DAYSECONDS - 1; push @filters, { ref => \&filter_endafter, param => $t+$from }; push @filters, { ref => \&filter_startbefore, param => $t+$to }; } elsif($limit =~ /from=([+-]?)(.+)/ ) { @@ -3591,6 +3599,8 @@ sub CalendarEventsAsHtml($;$) { a timespan <timespec> from now; use a minus sign for events in the past; <timespec> is described below in the Attributes section when=today|tomorrowshows events for today or tomorrow + when=<D1>shows events for day <D1> from now, <D1>= 0 stands for today, negative values allowed + when=<D1>..<D2>shows events for the day range from day <D1> to day <D2> from now
Examples:
@@ -4323,6 +4333,9 @@ sub CalendarEventsAsHtml($;$) { zeigt nur Termine die vor einer Zeitspanne <timespec> ab jetzt starten; Minuszeichen für Termine in der Vergangenheit benutzen; <timespec> wird weiter unten im Attribut-Abschnitt beschrieben. when=today|tomorrowzeigt anstehende Termin für heute oder morgen an + when=<D1>zeigt Termine für Tag <D1> von heute an, <D1>= 0 steht für heute, negative Werte sind erlaubt + when=<D1>..<D2>zeigt Termine für den Tagesbereich von Tag + <D1> bis Tag <D2> von heute an
Examples: