Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Localising Date Picker Fields in UserDefinedForm


5 Posts   1663 Views


3 August 2010 at 3:39am (Last edited: 3 August 2010 4:50am), Community Member, 11 Posts


I'm having trouble setting the date format to en_GB (dd-mm-yyyy) format when using a UserDefinedForm page.

In mysite/_config.php, I set the i18n config to my locale which seems to work elsewhere on the site, just not here. The DatePicker field inserts an en_US formatted date, and when submitted, the CMS validates it against en_GB so I'm pretty sure it's just down to the DatePicker.

I'm using 2.4.1

Any ideas?


3 August 2010 at 6:39pm Forum Moderator, 5511 Posts

The locale is hard coded in the UDF file. The files which you will need to edit are the EditableDateField.php file. getFormField() returns the datepicker so that needs to be passed the correct format using dateFormat (

I have created a ticket for this work -


3 August 2010 at 9:02pm (Last edited: 3 August 2010 9:22pm), Community Member, 11 Posts

Cheers Will..

I've updated EditableDateField.php to specify jQuery UI's dateFormat when datepicker is called on the element. For now I'm using i18n::get_date_format().

Use the file below if you like, hope it helps others.


3 August 2010 at 9:12pm Forum Moderator, 5511 Posts

Sweet does that work? If it does attach that file up on the ticket and I can integrate it. I think that would be useful. I thought about having the format in the CMS but that seems a very edge case.


3 August 2010 at 9:28pm (Last edited: 3 August 2010 9:28pm), Community Member, 11 Posts

Yep it works. I've upped the file on trac.

In the meantime I'm just overriding it with a custom form field in mysite/code/fields/