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)
|
protected function valueToTimestamp($value)
|
||||||
{
|
{
|
||||||
|
if (is_string($value)) {
|
||||||
if (ctype_digit($value)) {
|
if (ctype_digit($value)) {
|
||||||
$value = (int) $value;
|
$value = (int) $value;
|
||||||
} elseif (is_string($value)) {
|
} else {
|
||||||
$value = strtotime($value);
|
$value = strtotime($value);
|
||||||
}
|
}
|
||||||
|
} elseif (! is_int($value)) {
|
||||||
if (is_int($value)) {
|
$value = (int) $value;
|
||||||
$value = $this->timestampForSql($value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $value;
|
return $this->timestampForSql($value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -58,7 +58,7 @@ foreach ($summary as $entry) {
|
||||||
$caption = sprintf(
|
$caption = sprintf(
|
||||||
$settings[$column]['tooltip'],
|
$settings[$column]['tooltip'],
|
||||||
$value,
|
$value,
|
||||||
$this->formatDate(strtotime($day))
|
$this->formatDate(strtotime($day ?? ''))
|
||||||
);
|
);
|
||||||
$linkFilter = Filter::matchAll(
|
$linkFilter = Filter::matchAll(
|
||||||
Filter::expression('timestamp', '<', strtotime($day . ' 23:59:59')),
|
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
|
* 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)
|
public function validateTime($time)
|
||||||
{
|
{
|
||||||
if ($time instanceof DateTime) {
|
if ($time instanceof DateTime) {
|
||||||
$dateTime = $time;
|
$dateTime = $time;
|
||||||
|
} elseif (is_string($time)) {
|
||||||
|
$dateTime = DateTime::createFromFormat('d/m/Y g:i A', $time);
|
||||||
} else {
|
} else {
|
||||||
$dateTime = new DateTime();
|
$dateTime = new DateTime();
|
||||||
$dateTime->setTimestamp($time);
|
$dateTime->setTimestamp($time);
|
||||||
|
|
Loading…
Reference in New Issue