CC-5594 : Remove all date_default_timezone_get()
using the user selected timezone in the form to calculate duration.
This commit is contained in:
parent
c732b44903
commit
39063aaadb
3 changed files with 22 additions and 11 deletions
|
@ -470,11 +470,13 @@ class Application_Service_ShowFormService
|
|||
}
|
||||
}
|
||||
|
||||
public function calculateDuration($start, $end)
|
||||
public function calculateDuration($start, $end, $timezone)
|
||||
{
|
||||
try {
|
||||
$startDateTime = new DateTime($start);
|
||||
$endDateTime = new DateTime($end);
|
||||
|
||||
$tz = new DateTimeZone($timezone);
|
||||
$startDateTime = new DateTime($start, $tz);
|
||||
$endDateTime = new DateTime($end, $tz);
|
||||
|
||||
$duration = $startDateTime->diff($endDateTime);
|
||||
|
||||
|
@ -490,6 +492,7 @@ class Application_Service_ShowFormService
|
|||
return $duration->format('%r%Hh %Im');
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
Logging::info($e->getMessage());
|
||||
return "Invalid Date";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue