lib/grid: Use PHP's DateTime instead of our DateTimeFactory

I'm about to drop the DateTimeFactory because date_default_timezone_set() in combination w/ PHP's DateTime is sufficient.

refs #6778
This commit is contained in:
Eric Lippmann 2015-05-19 11:14:41 +02:00
parent e87067db3b
commit 5cf8e2504e

View File

@ -3,10 +3,10 @@
namespace Icinga\Web\Widget\Chart; namespace Icinga\Web\Widget\Chart;
use Icinga\Util\DateTimeFactory; use DateInterval;
use DateTime;
use Icinga\Util\Color; use Icinga\Util\Color;
use Icinga\Web\Widget\AbstractWidget; use Icinga\Web\Widget\AbstractWidget;
use DateInterval;
/** /**
* Display a colored grid that visualizes a set of values for each day * Display a colored grid that visualizes a set of values for each day
@ -312,7 +312,7 @@ class HistoryColorGrid extends AbstractWidget {
private function monthName($month, $year) private function monthName($month, $year)
{ {
// TODO: find a way to render years without messing up the layout // TODO: find a way to render years without messing up the layout
$dt = DateTimeFactory::create($year . '-' . $month . '-01'); $dt = new DateTime($year . '-' . $month . '-01');
return $dt->format('M'); return $dt->format('M');
} }
@ -323,7 +323,7 @@ class HistoryColorGrid extends AbstractWidget {
*/ */
private function weekdayName($weekday) private function weekdayName($weekday)
{ {
$sun = DateTimeFactory::create('last Sunday'); $sun = new DateTime('last Sunday');
$interval = new DateInterval('P' . $weekday . 'D'); $interval = new DateInterval('P' . $weekday . 'D');
$sun->add($interval); $sun->add($interval);
return substr($sun->format('D'), 0, 2); return substr($sun->format('D'), 0, 2);