|
|
|
@ -24,15 +24,20 @@ class ProjectPresenter extends Presenter |
|
|
|
|
|
|
|
public function workDuration() |
|
|
|
{ |
|
|
|
if (is_null($this->entity->end_date)) { |
|
|
|
$startDate = $this->entity->start_date; |
|
|
|
$endDate = $this->entity->end_date; |
|
|
|
|
|
|
|
if (is_null($endDate)) { |
|
|
|
return '-'; |
|
|
|
} |
|
|
|
|
|
|
|
$workDuration = dateDifference($this->entity->start_date, $this->entity->end_date); |
|
|
|
if ((int) $workDuration > 30) { |
|
|
|
return dateDifference($this->entity->start_date, $this->entity->end_date, '%m Bulan %d Hari'); |
|
|
|
$workDuration = dateDifference($startDate, $endDate); |
|
|
|
if ((int) $workDuration > 365) { |
|
|
|
return dateDifference($startDate, $endDate, '%y Year(s) %m Month(s) %d Day(s)'); |
|
|
|
} elseif ((int) $workDuration > 30) { |
|
|
|
return dateDifference($startDate, $endDate, '%m Month(s) %d Day(s)'); |
|
|
|
} |
|
|
|
|
|
|
|
return $workDuration.' Hari'; |
|
|
|
return $workDuration.' Day(s)'; |
|
|
|
} |
|
|
|
} |