mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-09-23 06:39:18 +00:00
Ensure we get a duration, and default to 1 day if not.
This commit is contained in:
parent
76768719c9
commit
b673ec32e6
@ -56,13 +56,15 @@ function get_freebusy( $path_match, $range_start, $range_end, $bin_privs = null
|
|||||||
foreach( $expansion AS $k => $v ) {
|
foreach( $expansion AS $k => $v ) {
|
||||||
// echo "=====================================================\n";
|
// echo "=====================================================\n";
|
||||||
// printf( "Type: %s\n", $v->GetType());
|
// printf( "Type: %s\n", $v->GetType());
|
||||||
|
// print_r($v);
|
||||||
// echo "-----------------------------------------------------\n";
|
// echo "-----------------------------------------------------\n";
|
||||||
$dtstart = $v->GetProperty('DTSTART');
|
$start_date = $v->GetProperty('DTSTART');
|
||||||
// print_r($dtstart);
|
if ( !isset($start_date) ) continue;
|
||||||
$start_date = new RepeatRuleDateTime($dtstart->Value());
|
$start_date = new RepeatRuleDateTime($start_date->Value());
|
||||||
$duration = $v->GetProperty('DURATION');
|
$duration = $v->GetProperty('DURATION');
|
||||||
|
$duration = ( !isset($duration) ? 'P1D' : $duration->Value());
|
||||||
$end_date = clone($start_date);
|
$end_date = clone($start_date);
|
||||||
$end_date->modify( $duration->Value() );
|
$end_date->modify( $duration );
|
||||||
if ( $end_date < $range_start || $start_date > $range_end ) continue;
|
if ( $end_date < $range_start || $start_date > $range_end ) continue;
|
||||||
$thisfb = $start_date->UTC() .'/'. $end_date->UTC() . $extra;
|
$thisfb = $start_date->UTC() .'/'. $end_date->UTC() . $extra;
|
||||||
array_push( $fbtimes, $thisfb );
|
array_push( $fbtimes, $thisfb );
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user