Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTimeZone #1063

Open
ne2d opened this issue Jan 24, 2023 · 2 comments
Open

DateTimeZone #1063

ne2d opened this issue Jan 24, 2023 · 2 comments

Comments

@ne2d
Copy link

ne2d commented Jan 24, 2023

It's possible to set up here timezone? Something like this? $date->setTimezone(new \DateTimeZone('Europe/Prague'));

@mskocik
Copy link

mskocik commented Jun 13, 2023

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');
  });

@jspetrak
Copy link

jspetrak commented Jun 7, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants