summaryrefslogtreecommitdiffstats
path: root/RecurringType.php
diff options
context:
space:
mode:
authorsten <stenmarsh938@gmail.com>2016-03-22 11:11:15 +0300
committersten <stenmarsh938@gmail.com>2016-03-22 11:11:15 +0300
commit37bbec13baade4fc77c9d430948423afde3c814f (patch)
treec72659e09c27a3a8d732fa5581ef8801d7cb7935 /RecurringType.php
parentf3e859670eaef14b7a703316fcb73f1ca83cec93 (diff)
downloadscheduler-helper-php-37bbec13baade4fc77c9d430948423afde3c814f.zip
scheduler-helper-php-37bbec13baade4fc77c9d430948423afde3c814f.tar.gz
scheduler-helper-php-37bbec13baade4fc77c9d430948423afde3c814f.tar.bz2
Fix recurring misplacing if recurring events tarts before finding interval.
Diffstat (limited to 'RecurringType.php')
-rw-r--r--RecurringType.php9
1 files changed, 5 insertions, 4 deletions
diff --git a/RecurringType.php b/RecurringType.php
index e8193ed..9b88c44 100644
--- a/RecurringType.php
+++ b/RecurringType.php
@@ -267,11 +267,12 @@ class RecurringType {
$type = $this->getRecurringTypeValue();
//If recurring type is "year" then exit, else add months.
if ($type == self::REC_TYPE_DAY || $type == self::REC_TYPE_WEEK) {
- $step = $this->_transpose_size[$type] * $this->getRecurringTypeStepValue();
- $day = 24 * 60 * 60;
- $delta = floor(($intervalStartDateStamp - $recurringStartDateStamp) / ($day * $step));
- if ($delta > 0)
+ if($recurringStartDateStamp < $intervalStartDateStamp) {
+ $step = $this->_transpose_size[$type] * $this->getRecurringTypeStepValue();
+ $day = 24 * 60 * 60;
+ $delta = floor(($intervalStartDateStamp - $recurringStartDateStamp) / ($day * $step)) || 1;
$recurringInterval["start_date_stamp"] = $recurringStartDateStamp + $delta * $step * $day;
+ }
}
else {
$differenceStartDates = SchedulerHelperDate::differenceBetweenDates($intervalStartDateStamp, $recurringStartDateStamp);