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
1 changed files with 4 additions and 4 deletions

View File

@ -3,10 +3,10 @@
namespace Icinga\Web\Widget\Chart;
use Icinga\Util\DateTimeFactory;
use DateInterval;
use DateTime;
use Icinga\Util\Color;
use Icinga\Web\Widget\AbstractWidget;
use DateInterval;
/**
* 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)
{
// 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');
}
@ -323,7 +323,7 @@ class HistoryColorGrid extends AbstractWidget {
*/
private function weekdayName($weekday)
{
$sun = DateTimeFactory::create('last Sunday');
$sun = new DateTime('last Sunday');
$interval = new DateInterval('P' . $weekday . 'D');
$sun->add($interval);
return substr($sun->format('D'), 0, 2);