• Модуль: calendar
  • Путь к файлу: ~/bitrix/modules/calendar/lib/sync/office365/converter/converter.php
  • Класс: BitrixCalendarSyncOffice365ConverterConverter
  • Вызов: Converter::prepareDate
private function prepareDate(Office365DtoDateTimeDto $dateDto, string $originalTZ = null): Date
{
	$tz = Util::isTimezoneValid($dateDto->timeZone ?? '')
		? $dateDto->timeZone
		: $this->getDefaultTimezone();

	$phpDateTime = new DateTime($dateDto->dateTime, new DateTimeZone($tz));
	$eventDateTime = DateTime::createFromPhp($phpDateTime);

	if ($originalTZ)
	{
		$original = Util::prepareTimezone($originalTZ);
		$eventDateTime->setTimeZone($original);
	}

	return new Date($eventDateTime);
}