Currently date offsets in days/months/years are not properly supported, as internally date offsets are always applied in seconds. However the number of seconds of a day (due to DST), a month and a year varies. Because of that we'll have to build in specific support for applying offsets of e.g. 1 month.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | rules_date_offset_modify_5_2.patch | 652 bytes | mh86 |
Comments
Comment #1
fagoimplemented: http://drupalcode.org/project/rules.git/commit/ff728b9
As the entity api specifies that durations have to be represented in seconds, we cannot really change the storage format of duration and properly differentiate between e.g. 86400 * 30 seconds or "1 month". However, usually 1 month will be the desired duration so we'll just go with the higher units (years, months, days) if the number of (stored) seconds is high enough. For that I've baked in the assumption that 1 day == 24hours, 1 month == 30 days and 1 year == 12 months.
Comment #3
mh86 commentedUnfortunately the changes do not work in PHP 5.2, as there the date modify function returns NULL instead of the DateTime object (see http://www.php.net/manual/en/datetime.modify.php), leading to a PHP error in 5.2.
Attached patch fixes the code for PHP versions prior to 5.3
Comment #4
fagothanks, committed.