return $id;
}
+sub first_class {
+ my %class = @_;
+ $class{'duration'} =~ /(\d\d\d\d)(\d\d)(\d\d)-(\d\d\d\d)(\d\d)(\d\d)/;
+ my $days = Delta_Days($1,$2,$3,$4,$5,$6);
+ my $firstday = Date::Calc->new($1,$2,$3);
+ my $lastday = Date::Calc->new($4,$5,$6);
+ my $today;
+ my @days=();
+ foreach(split(" ",$class{'days'})) {
+ push @days, Decode_Day_of_Week($_);
+ }
+ my @off = ();
+ @off = @{$class{'off'}} if ($class{'off'});
+ for($today = $firstday; $today < $lastday; $today++) {
+ next unless(grep($_ == Day_of_Week($today->date), @days));
+ next if(grep($_ == "$today", @off));
+ return $today;
+ }
+ return undef;
+}
+
sub next_class {
my %class = @_;
$class{'duration'} =~ /(\d\d\d\d)(\d\d)(\d\d)-(\d\d\d\d)(\d\d)(\d\d)/;
print "DESCRIPTION:", $row->{'id'}, "\r\n";
print "LOCATION:", $row->{'location'}, "\r\n";
print "CATEGORIES:Education\r\n";
- print "DTSTART:", $startdate."T".$starttime, "00\r\n";
- print "DTEND:", $startdate."T".$stoptime, "00\r\n";
+ print "DTSTART:", first_class(%$row)."T".$starttime, "00\r\n";
+ print "DTEND:", first_class(%$row)."T".$stoptime, "00\r\n";
print "RRULE:W1 ", $row->{'days'} . " $stopdate", "T000000\r\n";
print("EXDATE:$day\r\n") if($day);
print "ATTENDEE;ROLE=OWNER;STATUS=CONFIRMED:", $opts{'name'}, "\r\n" if(defined($opts{'name'}));