summaryrefslogtreecommitdiffstats
path: root/RecurringType.php
diff options
context:
space:
mode:
authorsten <stenmarsh938@gmail.com>2016-03-22 10:34:11 +0300
committersten <stenmarsh938@gmail.com>2016-03-22 10:34:11 +0300
commitf3e859670eaef14b7a703316fcb73f1ca83cec93 (patch)
tree979062b5542c78ea0ab64c037551fa2c52931f34 /RecurringType.php
parent13053f9a9f7a29ad554ba2587f708c6fa65dba53 (diff)
downloadscheduler-helper-php-f3e859670eaef14b7a703316fcb73f1ca83cec93.zip
scheduler-helper-php-f3e859670eaef14b7a703316fcb73f1ca83cec93.tar.gz
scheduler-helper-php-f3e859670eaef14b7a703316fcb73f1ca83cec93.tar.bz2
Fix week recurrings sunday detection.
Diffstat (limited to 'RecurringType.php')
-rw-r--r--RecurringType.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/RecurringType.php b/RecurringType.php
index 138d2d6..e8193ed 100644
--- a/RecurringType.php
+++ b/RecurringType.php
@@ -32,6 +32,8 @@ class RecurringType {
private $_fields_values = array();
private $_recurring_start_date_stamp;
private $_recurring_end_date_stamp;
+
+ public static $start_on_monday = true;
public function __construct($recurringType, $recurringStartDateStamp, $recurringEndDateStamp)
{
@@ -303,8 +305,10 @@ class RecurringType {
private function _getRecurringDayStep($dateStamp, $recurringWeekDay)
{
$weekDay = SchedulerHelperDate::getDayOfWeek($dateStamp);
+ if(self::$start_on_monday) {
+ $recurringWeekDay = $recurringWeekDay == 0 ? 7 : $recurringWeekDay;
+ }
$dayStep = $recurringWeekDay - $weekDay;
- $dayStep = ($dayStep < 0) ? (SchedulerHelperDate::DAYS_IN_WEEK - (-$dayStep)) : $dayStep;
return $dayStep;
}