Context
On a Symfony form, I need to restrict a date field to avoid entering a date earlier than the current date.
I have seen in the Symfony official documentation that I can use the GreaterThan
constraint. Here is my code :
/**
* @var \DateTime
* @Assert\DateTime()
* @Assert\GreaterThan("now UTC+2")
*
* @ORM\Column(type="datetime", name="start_date")
*/
private $startDate;
I have setup my timezone the following way:
- In the OroPlatform dashboard :
System > Configuration > Localization
- I have put the timezone in
php.ini
of the Symfony Web Server
My timezone is Europe/Paris
Issue
I have done all the requirements described in the Context section. But, the js validator not working.
I'm living in France so my timezone is Europe/Paris
. If I do a dump(new \Datetime('now'))
the current datetime value is 10H48
How to adapt the js red alert to set the current js timezone to Europe/Paris
?
I have tried to run these commands symfony console cache:clear
and symfony console oro:localization:dump
but it doesn't change the timezone in the red message.