Merge pull request #4844 from Icinga/fix/timeline-and-eventgrid-4843
Fix timeline and eventgrid
This commit is contained in:
commit
d2e4e4b2ab
|
@ -224,17 +224,17 @@ class DbQuery extends SimpleQuery
|
|||
|
||||
protected function valueToTimestamp($value)
|
||||
{
|
||||
if (ctype_digit($value)) {
|
||||
if (is_string($value)) {
|
||||
if (ctype_digit($value)) {
|
||||
$value = (int) $value;
|
||||
} else {
|
||||
$value = strtotime($value);
|
||||
}
|
||||
} elseif (! is_int($value)) {
|
||||
$value = (int) $value;
|
||||
} elseif (is_string($value)) {
|
||||
$value = strtotime($value);
|
||||
}
|
||||
|
||||
if (is_int($value)) {
|
||||
$value = $this->timestampForSql($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
return $this->timestampForSql($value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -58,7 +58,7 @@ foreach ($summary as $entry) {
|
|||
$caption = sprintf(
|
||||
$settings[$column]['tooltip'],
|
||||
$value,
|
||||
$this->formatDate(strtotime($day))
|
||||
$this->formatDate(strtotime($day ?? ''))
|
||||
);
|
||||
$linkFilter = Filter::matchAll(
|
||||
Filter::expression('timestamp', '<', strtotime($day . ' 23:59:59')),
|
||||
|
|
|
@ -119,12 +119,14 @@ class TimeRange implements Iterator
|
|||
/**
|
||||
* Return whether the given time is within this range of time
|
||||
*
|
||||
* @param int|DateTime $time The timestamp or date and time to check
|
||||
* @param string|int|DateTime $time The timestamp or date and time to check
|
||||
*/
|
||||
public function validateTime($time)
|
||||
{
|
||||
if ($time instanceof DateTime) {
|
||||
$dateTime = $time;
|
||||
} elseif (is_string($time)) {
|
||||
$dateTime = DateTime::createFromFormat('d/m/Y g:i A', $time);
|
||||
} else {
|
||||
$dateTime = new DateTime();
|
||||
$dateTime->setTimestamp($time);
|
||||
|
|
Loading…
Reference in New Issue