mirror of
https://gitlab.com/davical-project/davical.git
synced 2026-05-22 02:04:19 +00:00
Don't change the day of the month to 28, if it is > 28
Gosh. The logic was saying, if the modified date has a day of the month > 28, change it to 28. Which is rather odd. Don't do that. This closes #248. It also fixes a bug with FREQ=MONTHLY;BYMONTHDAY=-1 as it turns out.
This commit is contained in:
parent
6e68c221e9
commit
a323ba8dae
@ -369,9 +369,6 @@ class RepeatRuleDateTime extends DateTime {
|
|||||||
if ( DEBUG_RRULE) dbg_error_log( 'RRULE', "Modify '%s' by: >>%s<<\n", $this->__toString(), $interval );
|
if ( DEBUG_RRULE) dbg_error_log( 'RRULE', "Modify '%s' by: >>%s<<\n", $this->__toString(), $interval );
|
||||||
// print_r($this);
|
// print_r($this);
|
||||||
if ( !isset($interval) || $interval == '' ) $interval = '1 day';
|
if ( !isset($interval) || $interval == '' ) $interval = '1 day';
|
||||||
if ( parent::format('d') > 28 && strstr($interval,'month') !== false ) {
|
|
||||||
$this->setDate(null,null,28);
|
|
||||||
}
|
|
||||||
parent::modify($interval);
|
parent::modify($interval);
|
||||||
if (DEBUG_RRULE) dbg_error_log( 'RRULE', "Modified to '%s'", $this->__toString() );
|
if (DEBUG_RRULE) dbg_error_log( 'RRULE', "Modified to '%s'", $this->__toString() );
|
||||||
return $this->__toString();
|
return $this->__toString();
|
||||||
|
|||||||
@ -258,17 +258,17 @@ SQL Result:
|
|||||||
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
|
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=
|
||||||
20110831 - RRULE:FREQ=MONTHLY;BYMONTHDAY=-1
|
20110831 - RRULE:FREQ=MONTHLY;BYMONTHDAY=-1
|
||||||
The last day of each month
|
The last day of each month
|
||||||
PHP & SQL results are identical (-:
|
PHP & SQL results differ :-(
|
||||||
PHP Result:
|
PHP Result:
|
||||||
|
|
||||||
2011-08-31 00:00:00 2011-09-30 00:00:00 2011-10-31 00:00:00 2011-11-30 00:00:00
|
2011-08-31 00:00:00 2011-10-31 00:00:00 2011-11-30 00:00:00 2011-12-31 00:00:00
|
||||||
2011-12-31 00:00:00 2012-01-31 00:00:00 2012-02-29 00:00:00 2012-03-31 00:00:00
|
2012-01-31 00:00:00 2012-02-29 00:00:00 2012-03-31 00:00:00 2012-04-30 00:00:00
|
||||||
2012-04-30 00:00:00 2012-05-31 00:00:00 2012-06-30 00:00:00 2012-07-31 00:00:00
|
2012-05-31 00:00:00 2012-06-30 00:00:00 2012-07-31 00:00:00 2012-08-31 00:00:00
|
||||||
2012-08-31 00:00:00 2012-09-30 00:00:00 2012-10-31 00:00:00 2012-11-30 00:00:00
|
2012-09-30 00:00:00 2012-10-31 00:00:00 2012-11-30 00:00:00 2012-12-31 00:00:00
|
||||||
2012-12-31 00:00:00 2013-01-31 00:00:00 2013-02-28 00:00:00 2013-03-31 00:00:00
|
2013-01-31 00:00:00 2013-02-28 00:00:00 2013-03-31 00:00:00 2013-04-30 00:00:00
|
||||||
2013-04-30 00:00:00 2013-05-31 00:00:00 2013-06-30 00:00:00 2013-07-31 00:00:00
|
2013-05-31 00:00:00 2013-06-30 00:00:00 2013-07-31 00:00:00 2013-08-31 00:00:00
|
||||||
2013-08-31 00:00:00 2013-09-30 00:00:00 2013-10-31 00:00:00 2013-11-30 00:00:00
|
2013-09-30 00:00:00 2013-10-31 00:00:00 2013-11-30 00:00:00 2013-12-31 00:00:00
|
||||||
2013-12-31 00:00:00 2014-01-31 00:00:00
|
2014-01-31 00:00:00 2014-02-28 00:00:00
|
||||||
|
|
||||||
SQL Result:
|
SQL Result:
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user