mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-03-13 08:00:15 +00:00
Make 'WEEKLY' a first-class frequency.
This commit is contained in:
parent
1f0ee84006
commit
40212665ca
@ -747,10 +747,10 @@ class RRule {
|
||||
$this->_part['INTERVAL'] *= 12;
|
||||
$this->_part['FREQ'] = "MONTHLY";
|
||||
}
|
||||
if ( $this->_part['FREQ'] == "WEEKLY" ) {
|
||||
$this->_part['INTERVAL'] *= 7;
|
||||
$this->_part['FREQ'] = "DAILY";
|
||||
}
|
||||
// if ( $this->_part['FREQ'] == "WEEKLY" ) {
|
||||
// $this->_part['INTERVAL'] *= 7;
|
||||
// $this->_part['FREQ'] = "DAILY";
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@ -891,6 +891,34 @@ class RRule {
|
||||
dbg_error_log( "RRule", " GetNext: Found %d days for MONTHLY rule", count($days) );
|
||||
|
||||
}
|
||||
else if ( $this->_part['FREQ'] == "WEEKLY" ) {
|
||||
dbg_error_log( "RRule", " GetNext: Calculating more dates for WEEKLY rule" );
|
||||
$limit = 100;
|
||||
do {
|
||||
$limit--;
|
||||
if ( $this->_started ) {
|
||||
$next->AddDays($this->_part['INTERVAL'] * 7);
|
||||
}
|
||||
else {
|
||||
$this->_started = true;
|
||||
}
|
||||
|
||||
if ( isset($this->_part['BYDAY']) ) {
|
||||
$days = $next->GetWeekByDay($this->_part['BYDAY'], false );
|
||||
}
|
||||
else
|
||||
$days[$next->_dd] = $next->_dd;
|
||||
|
||||
if ( isset($this->_part['BYSETPOS']) ) {
|
||||
$days = $next->ApplyBySetpos($this->_part['BYSETPOS'], $days);
|
||||
}
|
||||
|
||||
$days = $this->WithinScope( $next, $days);
|
||||
}
|
||||
while( $limit && count($days) < 1 && ! $this->_finished );
|
||||
|
||||
dbg_error_log( "RRule", " GetNext: Found %d days for WEEKLY rule", count($days) );
|
||||
}
|
||||
else if ( $this->_part['FREQ'] == "DAILY" ) {
|
||||
dbg_error_log( "RRule", " GetNext: Calculating more dates for DAILY rule" );
|
||||
$limit = 100;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user