Jump to:

23488 Posts in 18005 Topics by 2863 members

General Questions

SilverStripe Forums » General Questions » CalendarDateField implemented in 2.4RC1?

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

Page: 1 2
Go to End
Author Topic: 3852 Views
  • ttyl
    Avatar
    Community Member
    114 Posts

    Re: CalendarDateField implemented in 2.4RC1? Link to this post

    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.

  • bmc38119
    Avatar
    Community Member
    45 Posts

    Re: CalendarDateField implemented in 2.4RC1? Link to this post

    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.

  • ttyl
    Avatar
    Community Member
    114 Posts

    Re: CalendarDateField implemented in 2.4RC1? Link to this post

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

    3852 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.