mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-09 20:57:11 +00:00
57_Calender: limit specification when=... amended
git-svn-id: https://svn.fhem.de/fhem/trunk@25010 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
9c2e22849e
commit
2bb02ca9a1
@ -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
|
||||
|
@ -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</td></tr>
|
||||
<tr><td><code>when=today|tomorrow</code></td><td>shows events for today or tomorrow</td></tr>
|
||||
<tr><td><code>when=<D1></code></td><td>shows events for day <D1> from now, <D1>= 0 stands for today, negative values allowed </td></tr>
|
||||
<tr><td><code>when=<D1>..<D2></code></td><td>shows events for the day range from day <D1> to day <D2> from now</td></tr>
|
||||
</table><br>
|
||||
|
||||
Examples:<br>
|
||||
@ -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.</td></tr>
|
||||
<tr><td><code>when=today|tomorrow</code></td><td>zeigt anstehende Termin für heute oder morgen an</td></tr>
|
||||
<tr><td><code>when=<D1></code></td><td>zeigt Termine für Tag <D1> von heute an, <D1>= 0 steht für heute, negative Werte sind erlaubt</td></tr>
|
||||
<tr><td><code>when=<D1>..<D2></code></td><td>zeigt Termine für den Tagesbereich von Tag
|
||||
<D1> bis Tag <D2> von heute an</td></tr>
|
||||
</table><br>
|
||||
|
||||
Examples:<br>
|
||||
|
Loading…
x
Reference in New Issue
Block a user