Commit dcb16d75 authored by Jan Helke's avatar Jan Helke

[TASK] Refactor date calculation

parent edebb63e
Pipeline #57277756 passed with stage
in 2 minutes and 12 seconds
......@@ -20,7 +20,7 @@ use TYPO3\CMS\Backend\Module\BaseScriptClass;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Cal\Controller\DateParser;
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
use TYPO3\CMS\Cal\Utility\RecurrenceGenerator;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Messaging\FlashMessage;
......@@ -359,9 +359,9 @@ class CalIndexer extends BaseScriptClass
/**
* @param $timeString
* @return CalDate
* @return CalendarDateTime
*/
private function getTimeParsed($timeString): CalDate
private function getTimeParsed($timeString): CalendarDateTime
{
$dp = GeneralUtility::makeInstance(DateParser::class);
$dp->parse($timeString, 0, '');
......
......@@ -18,7 +18,7 @@ use TYPO3\CMS\Backend\Module\BaseScriptClass;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Cal\Controller\DateParser;
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
use TYPO3\CMS\Cal\Utility\RecurrenceGenerator;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Messaging\FlashMessage;
......@@ -265,9 +265,9 @@ class CalIndexerOld extends BaseScriptClass
/**
* @param $timeString
* @return CalDate
* @return CalendarDateTime
*/
private function getTimeParsed($timeString): CalDate
private function getTimeParsed($timeString): CalendarDateTime
{
$dp = GeneralUtility::makeInstance(DateParser::class);
$dp->parse($timeString, 0, '');
......
......@@ -15,7 +15,7 @@ namespace TYPO3\CMS\Cal\Backend\TCA;
* The TYPO3 extension Calendar Base (cal) project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
/**
* Class Labels
......@@ -30,27 +30,17 @@ class Labels
*/
public function getEventRecordLabel(&$params, &$pObj)
{
if ($params['table'] != 'tx_cal_event' && $params['table'] != 'tx_cal_exception_event') {
if ($params['table'] !== 'tx_cal_event' && $params['table'] !== 'tx_cal_exception_event') {
return '';
}
// Get complete record
$rec = BackendUtility::getRecordWSOL($params['table'], $params['row']['uid']);
$dateObj = new CalDate($rec['start_date'] . '000000');
$dateObj = new CalendarDateTime($rec['start_date'] . '000000');
$dateObj->setTZbyID('UTC');
$format = str_replace([
'd',
'm',
'y',
'Y'
], [
'%d',
'%m',
'%y',
'%Y'
], $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy']);
if ($rec['allday'] || $params['table'] == 'tx_cal_exception_event') {
$format = $GLOBALS['TYPO3_CONF_VARS']['SYS']['ddmmyy'];
if ($rec['allday'] || $params['table'] === 'tx_cal_exception_event') {
/* If we have an all day event, only show the date */
$datetime = $dateObj->format($format);
$params['start_date'] = $datetime;
......@@ -81,7 +71,7 @@ class Labels
*/
public function getAttendeeRecordLabel(&$params, &$pObj)
{
if (!$params['table'] == 'tx_cal_attendee') {
if (!$params['table'] === 'tx_cal_attendee') {
return '';
}
......@@ -107,7 +97,7 @@ class Labels
*/
public function getMonitoringRecordLabel(&$params, &$pObj)
{
if (!$params['table'] == 'tx_cal_fe_user_event_monitor_mm') {
if (!$params['table'] === 'tx_cal_fe_user_event_monitor_mm') {
return '';
}
......@@ -142,7 +132,7 @@ class Labels
*/
public function getDeviationRecordLabel(&$params, &$pObj)
{
if (!$params['table'] == 'tx_cal_event_deviation') {
if (!$params['table'] === 'tx_cal_event_deviation') {
return '';
}
......@@ -152,7 +142,7 @@ class Labels
$label = $GLOBALS['LANG']->sL('LLL:EXT:cal/Resources/Private/Language/locallang_db.xml:tx_cal_event.deviation') . ': ';
if ($rec['orig_start_date']) {
$dateObj = new CalDate($rec['orig_start_date'] . '000000');
$dateObj = new CalendarDateTime($rec['orig_start_date'] . '000000');
$dateObj->setTZbyID('UTC');
$format = str_replace([
......
......@@ -396,7 +396,7 @@ class Api
*/
public function findEventsWithin($startTimestamp, $endTimestamp, $type = '', $pidList = ''): array
{
return $this->modelObj->findAllWithin('cal_event_model', $startTimestamp, $endTimestamp, $type, 'event', $pidList);
return $this->modelObj->findAllWithin('cal_event_model', clone $startTimestamp, clone $endTimestamp, $type, 'event', $pidList);
}
/**
......
......@@ -14,8 +14,7 @@ namespace TYPO3\CMS\Cal\Controller;
*
* The TYPO3 extension Calendar Base (cal) project - inspiring people to share!
*/
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\Pear\Date\Calc;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
/**
* This class combines all the time related functions
......@@ -86,116 +85,96 @@ class Calendar
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateStartDayTime($dateObject = ''): CalDate
public static function calculateStartDayTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = new CalDate();
$timeObj->setTZbyID('UTC');
if ($dateObject) {
$timeObj->copy($dateObject);
}
$timeObj->setHour(0);
$timeObj->setMinute(0);
$timeObj->setSecond(0);
return $timeObj;
$dateObject->setTZbyID('UTC');
$dateObject->setHour(0);
$dateObject->setMinute(0);
$dateObject->setSecond(0);
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateEndDayTime($dateObject = ''): CalDate
public static function calculateEndDayTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = new CalDate();
$timeObj->setTZbyID('UTC');
if ($dateObject) {
$timeObj->copy($dateObject);
}
$timeObj->setHour(23);
$timeObj->setMinute(59);
$timeObj->setSecond(59);
return $timeObj;
$dateObject->setTZbyID('UTC');
$dateObject->setHour(23);
$dateObject->setMinute(59);
$dateObject->setSecond(59);
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateStartWeekTime($dateObject = ''): CalDate
public static function calculateStartWeekTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartDayTime($dateObject);
$timeObj = new CalDate(Calc::beginOfWeek(
$timeObj->getDay(),
$timeObj->getMonth(),
$timeObj->getYear()
));
$timeObj->setTZbyID('UTC');
return $timeObj;
$dateObject = self::calculateStartDayTime($dateObject);
$dateObject->setDay($dateObject->format('j') - $dateObject->format('w'));
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateEndWeekTime($dateObject = ''): CalDate
public static function calculateEndWeekTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartWeekTime($dateObject);
$timeObj->addSeconds(604799);
return $timeObj;
$dateObject = self::calculateStartWeekTime($dateObject);
$dateObject->addSeconds(604799);
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateStartMonthTime($dateObject = ''): CalDate
public static function calculateStartMonthTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartDayTime($dateObject);
$timeObj->setDay(1);
return $timeObj;
$dateObject = self::calculateStartDayTime($dateObject);
$dateObject->setDay(1);
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateEndMonthTime($dateObject = ''): CalDate
public static function calculateEndMonthTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartDayTime($dateObject);
$timeObj = new CalDate(Calc::endOfNextMonth(
$timeObj->getDay(),
$timeObj->getMonth(),
$timeObj->getYear()
));
$timeObj->setDay(1);
$timeObj->subtractSeconds(1);
$timeObj->setTZbyID('UTC');
return $timeObj;
$dateObject = self::calculateEndDayTime($dateObject);
$dateObject->setDay($dateObject->format('t'));
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateStartYearTime($dateObject = ''): CalDate
public static function calculateStartYearTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartMonthTime($dateObject);
$timeObj->setMonth(1);
return $timeObj;
$dateObject = self::calculateStartMonthTime($dateObject);
$dateObject->setMonth(1);
return $dateObject;
}
/**
* @param string $dateObject
* @return CalDate
* @param CalendarDateTime $dateObject
* @return CalendarDateTime
*/
public static function calculateEndYearTime($dateObject = ''): CalDate
public static function calculateEndYearTime(CalendarDateTime $dateObject): CalendarDateTime
{
$timeObj = self::calculateStartYearTime($dateObject);
$timeObj->setYear($timeObj->getYear() + 1);
$timeObj->subtractSeconds(1);
return $timeObj;
$dateObject = self::calculateStartYearTime($dateObject);
$dateObject->setYear($dateObject->getYear() + 1);
$dateObject->subtractSeconds(1);
return $dateObject;
}
/**
......
This diff is collapsed.
......@@ -14,11 +14,12 @@ namespace TYPO3\CMS\Cal\Controller;
*
* The TYPO3 extension Calendar Base (cal) project - inspiring people to share!
*/
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
use TYPO3\CMS\Cal\Model\Pear\Date\Calc;
/**
* date parser
* @deprecated
*/
class DateParser
{
......@@ -68,7 +69,7 @@ class DateParser
public $special = '';
/**
* @var CalDate
* @var CalendarDateTime
*/
public $timeObj;
......@@ -80,20 +81,18 @@ class DateParser
/**
* @param $value
* @param array $conf
* @param string $timeObj
* @param CalendarDateTime $timeObj
*/
public function parse($value, $conf = [], $timeObj = '')
public function parse($value, $conf = [], $timeObj = null)
{
if ($timeObj === '') {
$timeObj = new CalDate();
if ($timeObj === null) {
$timeObj = new CalendarDateTime();
$timeObj->setTZbyID('UTC');
}
$this->timeObj = $timeObj;
$this->conf = &$conf;
if (!empty($value) && is_array($value)) {
foreach ($value as $iValue) {
$chr = $iValue;
foreach ($value as $chr) {
switch ($chr) {
case ' ':
case '_':
......@@ -271,27 +270,27 @@ class DateParser
break;
case 'now':
$this->stack[] = [
'abs' => $this->timeObj->getTime()
'abs' => $this->timeObj->format('U')
];
break;
case 'today':
$this->stack[] = [
'today' => $this->timeObj->getTime()
'today' => $this->timeObj->format('U')
];
break;
case 'current':
$this->stack[] = [
'today' => $this->timeObj->getTime()
'today' => $this->timeObj->format('U')
];
break;
case 'tomorrow':
$this->stack[] = [
'tomorrow' => $this->timeObj->getTime()
'tomorrow' => $this->timeObj->format('U')
];
break;
case 'yesterday':
$this->stack[] = [
'yesterday' => $this->timeObj->getTime()
'yesterday' => $this->timeObj->format('U')
];
break;
......@@ -540,13 +539,13 @@ class DateParser
}
/**
* @return CalDate
* @return CalendarDateTime
*/
public function getDateObjectFromStack(): CalDate
public function getDateObjectFromStack(): CalendarDateTime
{
$date = new CalDate();
$date = new CalendarDateTime();
$date->setTZbyID('UTC');
$date->copy($this->timeObj);
$date->copy($this->timeObj ?? new CalendarDateTime());
$lastKey = '';
$post = [];
$foundMonth = false;
......@@ -696,7 +695,7 @@ class DateParser
}
/**
* @param CalDate$date
* @param CalendarDateTime$date
* @param $range
* @param $rangeValue
*/
......@@ -721,7 +720,7 @@ class DateParser
$date->getMonth(),
$date->getYear()
);
$date = new CalDate($formatedDate);
$date = new CalendarDateTime($formatedDate);
$date->setTZbyID('UTC');
}
} elseif ($key === 'weekday' && $range < 0) {
......@@ -732,7 +731,7 @@ class DateParser
$date->getMonth(),
$date->getYear()
);
$date = new CalDate($formatedDate);
$date = new CalendarDateTime($formatedDate);
$date->setTZbyID('UTC');
}
} elseif ($value === 'week' && $range > 0) {
......@@ -745,7 +744,7 @@ class DateParser
if ($rangeValue === 'month') {
for ($i = 0; $i < $range; $i++) {
$days = Calc::daysInMonth($date->getMonth(), $date->getYear());
$endOfNextMonth = new CalDate(Calc::endOfNextMonth(
$endOfNextMonth = new CalendarDateTime(Calc::endOfNextMonth(
$date->getDay(),
$date->getMonth(),
$date->getYear()
......@@ -769,7 +768,7 @@ class DateParser
} elseif ($range < 0) {
if ($rangeValue === 'month') {
for ($i = 0; $i > $range; $i--) {
$endOfPrevMonth = new CalDate(Calc::endOfPrevMonth(
$endOfPrevMonth = new CalendarDateTime(Calc::endOfPrevMonth(
$date->getDay(),
$date->getMonth(),
$date->getYear()
......
......@@ -16,11 +16,13 @@ namespace TYPO3\CMS\Cal\Controller;
*/
use PDO;
use TYPO3\CMS\Cal\Model\AttendeeModel;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
use TYPO3\CMS\Cal\Model\CategoryModel;
use TYPO3\CMS\Cal\Model\EventModel;
use TYPO3\CMS\Cal\Model\Location;
use TYPO3\CMS\Cal\Model\Organizer;
use TYPO3\CMS\Cal\Service\AttendeeService;
use TYPO3\CMS\Cal\Service\CalculateDateTimeService;
use TYPO3\CMS\Cal\Service\CalendarService;
use TYPO3\CMS\Cal\Service\EventService;
use TYPO3\CMS\Cal\Service\LocationService;
......@@ -593,9 +595,9 @@ class ModelController extends BaseController
*/
public function findEventsForDay(&$dateObject, $type = '', $pidList = '', $eventType = '0,1,2,3'): array
{
$starttime = Calendar::calculateStartDayTime($dateObject);
$endtime = Calendar::calculateEndDayTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, 'event', $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfDay(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfDay(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, 'event', $pidList, $eventType);
}
/**
......@@ -607,9 +609,9 @@ class ModelController extends BaseController
*/
public function findEventsForWeek(&$dateObject, $type = '', $pidList = '', $eventType = '0,1,2,3'): array
{
$starttime = Calendar::calculateStartWeekTime($dateObject);
$endtime = Calendar::calculateEndWeekTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, 'event', $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfWeek(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfWeek(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, 'event', $pidList, $eventType);
}
/**
......@@ -621,9 +623,9 @@ class ModelController extends BaseController
*/
public function findEventsForMonth(&$dateObject, $type = '', $pidList = '', $eventType = '0,1,2,3'): array
{
$starttime = Calendar::calculateStartMonthTime($dateObject);
$endtime = Calendar::calculateEndMonthTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, 'event', $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfMonth(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfMonth(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, 'event', $pidList, $eventType);
}
/**
......@@ -635,9 +637,9 @@ class ModelController extends BaseController
*/
public function findEventsForYear(&$dateObject, $type = '', $pidList = '', $eventType = '0,1,2,3'): array
{
$starttime = Calendar::calculateStartYearTime($dateObject);
$endtime = Calendar::calculateEndYearTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, 'event', $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfYear(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfYear(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, 'event', $pidList, $eventType);
}
/**
......@@ -657,7 +659,7 @@ class ModelController extends BaseController
$eventType = '0,1,2,3',
$additionalWhere = ''
): array {
return $this->findAllWithin('cal_event_model', $startDateObject, $endDateObject, $type, 'event', $pidList, $eventType, $additionalWhere);
return $this->findAllWithin('cal_event_model', clone $startDateObject, clone $endDateObject, $type, 'event', $pidList, $eventType, $additionalWhere);
}
/**
......@@ -669,9 +671,9 @@ class ModelController extends BaseController
*/
public function findTodosForDay(&$dateObject, $type = '', $pidList = '', $eventType = '4'): array
{
$starttime = Calendar::calculateStartDayTime($dateObject);
$endtime = Calendar::calculateEndDayTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, $this->todoSubtype, $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfDay(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfDay(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, $this->todoSubtype, $pidList, $eventType);
}
/**
......@@ -683,9 +685,9 @@ class ModelController extends BaseController
*/
public function findTodosForWeek(&$dateObject, $type = '', $pidList = '', $eventType = '4'): array
{
$starttime = Calendar::calculateStartWeekTime($dateObject);
$endtime = Calendar::calculateEndWeekTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, $this->todoSubtype, $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfWeek(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfWeek(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, $this->todoSubtype, $pidList, $eventType);
}
/**
......@@ -697,9 +699,9 @@ class ModelController extends BaseController
*/
public function findTodosForMonth(&$dateObject, $type = '', $pidList = '', $eventType = '4'): array
{
$starttime = Calendar::calculateStartMonthTime($dateObject);
$endtime = Calendar::calculateEndMonthTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, $this->todoSubtype, $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfMonth(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfMonth(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, $this->todoSubtype, $pidList, $eventType);
}
/**
......@@ -711,9 +713,9 @@ class ModelController extends BaseController
*/
public function findTodosForYear(&$dateObject, $type = '', $pidList = '', $eventType = '4'): array
{
$starttime = Calendar::calculateStartYearTime($dateObject);
$endtime = Calendar::calculateEndYearTime($dateObject);
return $this->findAllWithin('cal_event_model', $starttime, $endtime, $type, $this->todoSubtype, $pidList, $eventType);
$starttime = CalculateDateTimeService::calculateStartOfYear(clone $dateObject);
$endtime = CalculateDateTimeService::calculateEndOfYear(clone $dateObject);
return $this->findAllWithin('cal_event_model', clone $starttime, clone $endtime, $type, $this->todoSubtype, $pidList, $eventType);
}
/**
......@@ -726,7 +728,7 @@ class ModelController extends BaseController
*/
public function findTodosForList(&$startDateObject, &$endDateObject, $type = '', $pidList = '', $eventType = '4'): array
{
return $this->findAllWithin('cal_event_model', $startDateObject, $endDateObject, $type, $this->todoSubtype, $pidList, $eventType);
return $this->findAllWithin('cal_event_model', clone $startDateObject, clone $endDateObject, $type, $this->todoSubtype, $pidList, $eventType);
}
/**
......@@ -768,7 +770,7 @@ class ModelController extends BaseController
*/
public function findEventsForRss(&$startDateObject, &$endDateObject, $type, $pidList): array
{
return $this->findAllWithin('cal_event_model', $startDateObject, $endDateObject, $type, 'event', $pidList, '0,1,2,3');
return $this->findAllWithin('cal_event_model', clone $startDateObject, clone $endDateObject, $type, 'event', $pidList, '0,1,2,3');
}
/**
......@@ -790,7 +792,7 @@ class ModelController extends BaseController
*/
public function findTodosForRss(&$startDateObject, &$endDateObject, $type, $pidList): array
{
return $this->findAllWithin('cal_event_model', $startDateObject, $endDateObject, $type, $this->todoSubtype, $pidList, '4');
return $this->findAllWithin('cal_event_model', clone $startDateObject, clone $endDateObject, $type, $this->todoSubtype, $pidList, '4');
}
/**
......@@ -905,8 +907,8 @@ class ModelController extends BaseController
*/
public function findAllWithin(
$serviceName,
&$startDateObject,
&$endDateObject,
$startDateObject,
$endDateObject,
$type = '',
$subtype = '',
$pidList = '',
......@@ -917,12 +919,11 @@ class ModelController extends BaseController
if ($type === '') {
$serviceChain = '';
$events = [];
/* Iterate over all classes providing the cal_model service */
while (is_object($service = GeneralUtility::makeInstanceService($serviceName, $subtype, $serviceChain))) {
$serviceChain .= ',' . $service->getServiceKey();
/* Gets all events from the current model as an array */
$eventsFromService = $service->findAllWithin($startDateObject, $endDateObject, $pidList, $eventType, $additionalWhere);
$eventsFromService = $service->findAllWithin(new CalendarDateTime($startDateObject->format('Y-m-d H:i:s')), new CalendarDateTime($endDateObject->format('Y-m-d H:i:s')), $pidList, $eventType, $additionalWhere);
if (!empty($eventsFromService)) {
if (empty($events)) {
......
......@@ -2,8 +2,6 @@
namespace TYPO3\CMS\Cal\Hooks;
use TYPO3\CMS\Cal\Model\CalDate;
/**
* This file is part of the TYPO3 extension Calendar Base (cal).
*
......@@ -40,7 +38,7 @@ class Befunc
public function postprocessvalue(&$conf): string
{
if ($conf['colConf']['tx_cal_event']) {
$value = new CalDate($conf['value'] . '000000');
$value = new CalendarDateTime($conf['value'] . '000000');
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] === '1') {
$conf['value'] = $value->format('d.m.Y');
} else {
......
......@@ -15,7 +15,6 @@ namespace TYPO3\CMS\Cal\Hooks;
* The TYPO3 extension Calendar Base (cal) project - inspiring people to share!
*/
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Cal\Model\CalDate;
/**
* This hook extends the tcemain class.
......@@ -101,9 +100,9 @@ class TceFormsGetmainfields
public function formatDate($ymdDate, $format)
{
if ($ymdDate) {
$dateObj = new CalDate(intval($ymdDate) . '000000');
$dateObj = new CalendarDateTime(intval($ymdDate) . '000000');
$dateObj->setTZbyID('UTC');
return $dateObj->getTime();
return $dateObj->format('U');
}
$dateString = '';
......
......@@ -17,7 +17,7 @@ use PDO;
use RuntimeException;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Cal\Controller\Api;
use TYPO3\CMS\Cal\Model\CalDate;
use TYPO3\CMS\Cal\Model\CalendarDateTime;
use TYPO3\CMS\Cal\Service\ICalendarService;
use TYPO3\CMS\Cal\Utility\Functions;
use TYPO3\CMS\Cal\Utility\RecurrenceGenerator;
......@@ -118,7 +118,7 @@ class TceMainProcessdatamap
$fileInfo = GeneralUtility::split_fileref($oldPath);
$GLOBALS ['TSFE']->tmpl->allowedPaths [] = $fileInfo ['path'];
$notificationService->controller->getDateTimeObject = new CalDate($event ['start_date'] . '000000');
$notificationService->controller->getDateTimeObject = new CalendarDateTime($event ['start_date'] . '000000');
$notificationService->notifyOfChanges($event, $fieldArray);
if ($fieldArray ['send_invitation']) {
$notificationService->invite($event);
......@@ -225,7 +225,7 @@ class TceMainProcessdatamap
$fileInfo = GeneralUtility::split_fileref($oldPath);
$GLOBALS ['TSFE']->tmpl->allowedPaths [] = $fileInfo ['path'];
$notificationService->controller->getDateTimeObject = new CalDate($event ['start_date'] . '000000');
$notificationService->controller->getDateTimeObject = new CalendarDateTime($event ['start_date'] . '000000');
if ($status === 'new') {