diff --git a/calendar/sitemgr/class.module_calendar_list.inc.php b/calendar/sitemgr/class.module_calendar_list.inc.php index 42823ceb3a..9149736f8c 100644 --- a/calendar/sitemgr/class.module_calendar_list.inc.php +++ b/calendar/sitemgr/class.module_calendar_list.inc.php @@ -254,20 +254,19 @@ class module_calendar_list extends Module if (($arguments['acceptDateParam']) && (get_var('date',array('POST','GET')))) { - $first = $start = (int) (strtotime(get_var('date',array('POST','GET'))) + + $first = (int) (strtotime(get_var('date',array('POST','GET'))) + (60 * 60 * 24 * 7 * $dateOffset)); } else { - $first = $start = (int) ($this->bo->now_su + + $first = (int) ($this->bo->now_su + (60 * 60 * 24 * 7 * $dateOffset)); } if ($arguments['useWeekStart']) { - $first = $this->ui->datetime->get_weekday_start( - adodb_date('Y',$start), - adodb_date('m',$start), - adodb_date('d',$start)); + $start = Api\DateTime($first); + $start->setWeekStart(); + $first = $start->format('ts'); } $last = (int) ($first + diff --git a/calendar/sitemgr/class.module_calendar_month.inc.php b/calendar/sitemgr/class.module_calendar_month.inc.php index 0df1ca33b7..8e0ad35dac 100644 --- a/calendar/sitemgr/class.module_calendar_month.inc.php +++ b/calendar/sitemgr/class.module_calendar_month.inc.php @@ -239,10 +239,9 @@ class module_calendar_month extends Module $start = (int) ($this->bo->now_su + (60 * 60 * 24 * 7 * $dateOffset)); } - $first = $this->ui->datetime->get_weekday_start( - adodb_date('Y',$start), - adodb_date('m',$start), - adodb_date('d',$start)); + $start = new Api\DateTime($start); + $start->setWeekstart(); + $first = $start->format('ts'); $last = strtotime("+$weeks weeks",$first) - 1; if ($arguments['showTitle']) diff --git a/calendar/sitemgr/class.module_calendar_planner.inc.php b/calendar/sitemgr/class.module_calendar_planner.inc.php index c448f0606a..165f0a2ecf 100644 --- a/calendar/sitemgr/class.module_calendar_planner.inc.php +++ b/calendar/sitemgr/class.module_calendar_planner.inc.php @@ -198,7 +198,7 @@ class module_calendar_planner extends Module } $this->arguments['resources']['options'] = array_unique($this->arguments['resources']['options']); $this->arguments['resources']['multiple'] = count($this->arguments['resources']['options']) ? 4 : 0; - + return parent::get_user_interface(); } @@ -281,7 +281,9 @@ class module_calendar_planner extends Module } elseif ($ui->planner_view == 'week' || $ui->planner_view == 'weekN') // weeekview { - $ui->first = $ui->datetime->get_weekday_start($ui->year,$ui->month,$ui->day); + $start = new Api\DateTime($ui->date); + $start->setWeekstart(); + $ui->first = $start->format('ts'); $ui->last = $ui->bo->date2array($this->first); $ui->last['day'] += ($ui->planner_view == 'week' ? 7 : 7 * $ui->cal_prefs['multiple_weeks'])-1; $ui->last['hour'] = 23; $ui->last['minute'] = $ui->last['sec'] = 59;