• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/classes/general/taskitem.php
  • Класс: CTaskItem
  • Вызов: CTaskItem::calculateDuration
public function calculateDuration()
{
	try
	{
		$this->ensureDataLoaded();
	}
	catch (TasksException $e)
	{
		return 0;
	}

	if(!$this->getEndDatePlan()) // limitless task
	{
		return 0;
	}

	if ($this->arTaskData['MATCH_WORK_TIME'] == 'Y')
	{
		$this->initializeCalendar();

		$duration = $this->calendar->calculateDuration($this->getStartDatePlanGmt(true), $this->getEndDatePlanGmt());
		return ($duration > 0 ? $duration : $this->getEndDatePlanGmt()->getTimestamp() - $this->getStartDatePlanGmt(true)->getTimestamp());
	}
	else
	{
		return ($this->getEndDatePlanGmt()->getTimestamp() - $this->getStartDatePlanGmt(true)->getTimestamp());
	}
}