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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

CalendarDateField implemented in 2.4RC1?


Go to End
Reply


11 Posts   4071 Views

Avatar
ttyl

Community Member, 114 Posts

7 May 2010 at 2:47am

Edited: 07/05/2010 6:53am

this turned out to be a really annoying problem. if your local is sent to US the dates validate as US date (mm/dd/yyyy) - but the available calendars input the date as (dd/mm/yyyy) so validation fails on any day over 12 (and gets the date wrong anyway if it is under 12). my solution was to use the datepickerfield from from dataobjectmanager but I had to alter line 6 of "dataobject_manager/code/date_picker_field/DatePickerField.php" from

static $dateFormat = "dd/mm/yy";
   to
static $dateFormat = "mm/dd/yy";

so US dates work.

Avatar
bmc38119

Community Member, 45 Posts

13 June 2010 at 4:02pm

fyi - i was able to avoid modifying the core code and set the US format in the main _congif.php file with the following:

DatePickerField::set_date_format('mdy');

this seems to work when using DatePickerField on pages and dataobjects.

Avatar
ttyl

Community Member, 114 Posts

16 June 2010 at 6:38am

Edited: 16/06/2010 6:45am

that works, and should be added to this page somehow: http://doc.silverstripe.org/datepickerfield

Go to Top