1
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-05-04 22:19:38 +00:00

98_alarmclock: fix Calendar

git-svn-id: https://svn.fhem.de/fhem/trunk@16811 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
FlorianZ 2018-06-03 10:55:33 +00:00
parent 268f05cf2d
commit 0228f0cbb9

View File

@ -1137,9 +1137,9 @@ sub alarmclock_holiday_check($)
}
elsif( IsDevice($HolidayDevice[0], "Calendar" ))
{
my $stoday = strftime("%2d.%2m.%2y", localtime(time));
my $stomorrow = strftime("%2d.%2m.%2y", localtime(time+86400));
my $line = Calendar_Get($defs{$HolidayDevice[0]},"get","text","mode=alarm|start|upcoming");
my $stoday = strftime("%2d.%2m.20%2y", localtime(time));
my $stomorrow = strftime("%2d.%2m.20%2y", localtime(time+86400));
my $line = Calendar_Get($defs{$HolidayDevice[0]},"get","events","format:text");
if ($line)
{
chomp($line);
@ -1147,7 +1147,7 @@ sub alarmclock_holiday_check($)
foreach $line (@lines)
{
chomp($line);
my $date = substr($line,0,8);
my $date = substr($line,0,10);
if (($date eq $stoday) && ($DayToday == 1))
{
my $todaydesc = substr($line,15);
@ -1242,14 +1242,14 @@ sub alarmclock_vacation_check($)
my $stomorrow = strftime("%2d.%2m.%2y", localtime(time+86400));
my @tday = split('\.',$stoday);
my @tmor = split('\.',$stomorrow);
my $fline = Calendar_Get($defs{$VacationDevice[0]},"get","full","mode=alarm|start|upcoming");
my $fline = Calendar_Get($defs{$VacationDevice[0]},"get","events","format:full");
my @lines = split('\n',$fline);
foreach $fline (@lines)
{
chomp($fline);
my @chunks = split(' ',$fline);
my @sday = split('\.',$chunks[2]);
my @eday = split('\.',substr($chunks[3],9,10));
my @eday = split('\.',substr($chunks[3],6,10));
my $rets = ($sday[2]-$tday[2]-2000)*365+($sday[1]-$tday[1])*31+($sday[0]-$tday[0]);
my $rete = ($eday[2]-$tday[2]-2000)*365+($eday[1]-$tday[1])*31+($eday[0]-$tday[0]);
if (($rete>=0) && ($rets<=0) && ($DayToday == 1))