blob: ba1f527e456b0386edf592b3646a96d9a116cc97 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<?php
namespace ipl\Web\Widget;
use Icinga\Date\DateFormatter;
use ipl\Html\BaseHtmlElement;
class TimeUntil extends BaseHtmlElement
{
/** @var int */
protected $until;
protected $tag = 'time';
protected $defaultAttributes = ['class' => 'time-until'];
public function __construct($until)
{
$this->until = (int) $until;
}
protected function assemble()
{
$dateTime = DateFormatter::formatDateTime($this->until);
$this->addAttributes([
'datetime' => $dateTime,
'title' => $dateTime
]);
$this->add(DateFormatter::timeUntil($this->until));
}
}
|