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?


Reply

11 Posts   3939 Views

Avatar
ttyl

7 May 2010 at 2:47am (Last edited: 7 May 2010 6:53am), Community Member, 114 Posts

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

13 June 2010 at 4:02pm Community Member, 45 Posts

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

16 June 2010 at 6:38am (Last edited: 16 June 2010 6:45am), Community Member, 114 Posts

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