Skip to content

Commit

Permalink
Macros: Add missing support for DateTime type macro
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 committed Jan 9, 2025
1 parent 4806939 commit 48fc880
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion library/Icingadb/Common/Macros.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Icinga\Module\Icingadb\Common;

use DateTime;
use Icinga\Application\Logger;
use Icinga\Module\Icingadb\Compat\CompatHost;
use Icinga\Module\Icingadb\Compat\CompatService;
Expand Down Expand Up @@ -120,6 +121,10 @@ public function resolveMacro(string $macro, $object): string
$value = null;
}

return $value !== null ? $value : $macro;
if ($value instanceof DateTime) {
$value = $value->getTimestamp();
}

return $value ?? $macro;
}
}

0 comments on commit 48fc880

Please sign in to comment.