I have an announce website, at the moment, I have a Subscribe form who ask the user to give me his timezone
$builder->add('timezone', ChoiceType::class, array(
'choices' => $choices
));
but I would like to change and take this information directly without asking the user in a form.
It's important for me because I will have a lot of users who will certainly not know their timezone and will choose a bad one.
Actually, I have announced who is the store with a date in GMT timezone but I would like to display them in the timezone from someone who is registered or not on my website.
For display i have two function:
{{ clanwar.rendezvous|localizeddate('full', 'short') }}
{{ clanwar.rendezvous|date("d F Y, G:i e P", user.timezone)}}
The first one gives a date with the default timezone and it takes the timezone from the server. (i can change by defining it manually) The second one needs to have a timezone from a registered user.
So both option can't be used for what I want to do.
I think I need to use a Javascript function. I would like to store the user timezone in my session and calculated all date with this information. But I didn't find a good function who can just find this element.
Do you know something who can help me? Thanks