• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/util/calendar.php
  • Класс: BitrixTasksUtilCalendar
  • Вызов: Calendar::getClosestWorkTime
public function getClosestWorkTime(DateTime $oldDate, $isForward = true)
{
	$date = clone $oldDate;

	$startDate = $isForward ? $date : null;
	$endDate = $isForward ? null : $date;

	$cb = function (DateTime $start, DateTime $end) use(&$date, $isForward)
	{
		$date = $isForward ? $start : $end;
		return false;
	};

	$this->processEachDay($startDate, $endDate, $isForward, $cb);

	return $date;
}