Reputation: 176
I'm new in Symfony, so excuse my ignorance. I try to edit date and time of some event using Sonata Admin and 'sonata_type_datetime_picker' field type. But sonata_type_datetime_picker return wrong time. It gives time for an hour less.
Here's a filled form field screenshot (time is 10:00):
Here's dump of form field value (time is 09:00):
Here's form field options:
->add('datebegin', 'sonata_type_datetime_picker', array(
'format' => 'dd.MM.yyyy HH:mm',
'label' => 'Event begins at...',
'dp_use_current' => false,
'model_timezone' => 'Europe/Moscow'
))
I'd like to note that this error exists only on the server. On my local machine everything is ok. What could it be?
Thanks a lot in advance!
Upvotes: 2
Views: 934
Reputation: 61
I've got this problem too. I think that you need to upgrade the software on your server (packet: tzdata etc).
See: https://en.wikipedia.org/wiki/Moscow_Time
If this doesn't help you, you can use this hack:
'view_timezone' => 'Europe/Minsk'
See:
For example:
->add('endTimestamp', 'sonata_type_datetime_picker', array(
'widget' => 'single_text',
'label' => 'sip_event_end_timestamp',
'dp_side_by_side' => true,
'dp_use_seconds' => false,
'model_timezone' => 'Europe/Moscow',
'view_timezone' => 'Europe/Minsk',
'format' => 'dd.MM.yyyy HH:mm'
)
)
Upvotes: 4