mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
webui - fix exception in Oxidized page date handling (#16475)
* fix exception in date handling * style
This commit is contained in:
@@ -958,16 +958,19 @@ function get_oxidized_nodes_list()
|
|||||||
//user cannot see this device, so let's skip it.
|
//user cannot see this device, so let's skip it.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
// Convert UTC time string to local timezone set
|
||||||
|
$utc_time = $object['time'];
|
||||||
|
$utc_date = new DateTime($utc_time, new DateTimeZone('UTC'));
|
||||||
|
$local_timezone = new DateTimeZone(date_default_timezone_get());
|
||||||
|
$local_date = $utc_date->setTimezone($local_timezone);
|
||||||
|
|
||||||
// Convert UTC time string to local timezone set
|
// Generate local time string
|
||||||
$utc_time = $object['time'];
|
$formatted_local_time = $local_date->format('Y-m-d H:i:s T');
|
||||||
$utc_date = new DateTime($utc_time, new DateTimeZone('UTC'));
|
} catch (Exception $e) {
|
||||||
$local_timezone = new DateTimeZone(date_default_timezone_get());
|
// Just display the current value of $object['time'];
|
||||||
$local_date = $utc_date->setTimezone($local_timezone);
|
$formatted_local_time = $object['time'];
|
||||||
|
}
|
||||||
// Generate local time string
|
|
||||||
$formatted_local_time = $local_date->format('Y-m-d H:i:s T');
|
|
||||||
|
|
||||||
echo '<tr>
|
echo '<tr>
|
||||||
<td>' . $device['device_id'] . '</td>
|
<td>' . $device['device_id'] . '</td>
|
||||||
<td>' . $object['name'] . '</td>
|
<td>' . $object['name'] . '</td>
|
||||||
|
Reference in New Issue
Block a user