diff --git a/src/TimesheetBundle/Entity/Timesheet.php b/src/TimesheetBundle/Entity/Timesheet.php index ff56b389..e13143c6 100644 --- a/src/TimesheetBundle/Entity/Timesheet.php +++ b/src/TimesheetBundle/Entity/Timesheet.php @@ -151,7 +151,12 @@ class Timesheet */ public function getDuration() { - return $this->duration; + if ($this->duration !== 0 || $this->begin === null) { + return $this->duration; + } + + $current = new \DateTime(); + return $current->getTimestamp() - $this->begin->getTimestamp(); } /**