Search code examples
jquerydatepickermomentjssymfony-sonatasonata

Sonata datepicker not working in other locale


I have a strange issue here: my (French) website is using sonata-admin 2.3, and for the dates in my forms I am trying to use the datepicker:

->add('birthDate', 'sonata_type_date_picker')

Display is fine, but when I submit a date, i get a "This value is not valid" (in french..) for the date, while with the standard date widget everything works fine. I tried setting the locale at en instead of fr and everything went back to place, the datepicker worked just fine.

This is a pretty nasty bug for me as the date widget is not very user-friendly and my client asks for the datepicker...Does anyone have an idea ?


Solution

  • Updating to latest version of Sonata fixed this. Moment JS was properly initiated.