Silverstripe crashes when trying to save a date
I'm trying to create a very simple performance class that extends dataobje开发者_JS百科ct and has a date for one of the fields but for some reason if I fill it out when I press 'Add' it just hangs. I've checked in the Chrome inspector and it fires off the Ajax request but the request never returns anything, I've even tried leaving it for a few minutes and still nothing returns and nothing gets puts in the error log either. If I leave the date blank and just fill out the text field it works fine, here is the code I'm using.
class Performance extends DataObject {
static $db = array(
'Title' => 'Varchar(255)',
'StartDate' => 'Date',
);
static $summary_fields = array(
'Title' => 'Title',
'Starts' => 'StartDate',
);
static $has_one = array(
'Production' => 'ProductionPage'
);
}
What's really weird is if I grab the ArticlePage class from the extending Silverstripe tutorial it works fine, it's just if I try and do it with a DataObject rather than a page that I run into this.
Would really appreciate any help with this, I've been struggling with it for hours now.
Try the Legacydatetimefields module: http://www.silverstripe.org/legacydatetimefields-module/
There was a change of how Silverstripe handles date and time in the latest version (2.4) which means some older code dealing with date and time doesn't work.
Hope this helps.
精彩评论