Open ne2d opened 1 year ago
You can set it in custom renderer through setRenderer
, although it renders usage of ColumnDateTime
useless and you can use ColumnText
instead. Something like this:
$tz = new \DateTimeZone('Europe/Prague');
$grid->setColumnText('date', 'Date') // of course you can call `addColumnDateTime`
->setRenderer(function($item) use ($tz) {
$date = $item->dateProp;
$date->setTimezone($tz);
return $date->format('Y-m-d');
});
@mskocik
although it renders usage of ColumnDateTime useless
If I keep using ColumnDateTime and use the custom renderer, does the column retain capability to sort by datetime values?
Edit ex post
Yes.
https://github.com/contributte/datagrid/blob/1b0ff6a229d471df21ef7a64132f9ebe76a8d947/src/Column/ColumnDateTime.php#L35
It's possible to set up here timezone? Something like this? $date->setTimezone(new \DateTimeZone('Europe/Prague'));