Hi all,
This is driving me mad! I've searched the forums, the api, the internet for any clues that might help me with this problem and I haven't found anything that works. I'm trying to extend the Page class and add two fields - a start date and end date = for an events page on my site.
The fields appear fine, but whenever I choose a date with the datepicker, it fills the new field out in the wrong format - it uses MM/dd/YYYY when it should be returning dd/MM/YYYY.
Can anyone tell me what I'm doing wrong here?
I'm using the 3.0.0 beta, which I appreciate isn't a finished product, as I'm hoping to learn SilverStripe before v3 is officially released.
Thanks,
Loz
class EventPage extends Page {
static $db = array (
'EventStartDate' => 'Date',
'EventFinishDate' => 'Date'
);
static $has_one = array (
);
function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Main', $startDateField = new DateField('EventStartDate','Event Start Date'), 'Content');
$startDateField->setConfig('showcalendar', true);
$startDateField->setConfig('dateformat', 'dd/MM/YYYY');
$fields->addFieldToTab('Root.Main', $endDateField = new DateField('EventFinishDate','Event Finish Date'), 'Content');
$endDateField->setConfig('showcalendar', true);
$endDateField->setConfig('dateformat', 'dd/MM/YYYY');
return $fields;
}
}