mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: Fixed date field manipulation.
MINOR: Added sorts to TableListFieldTest git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@79327 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
02d4c34d6f
commit
4df21d29e0
@ -265,16 +265,14 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
||||
// MSSQLDatabase::date() uses datetime for the data type for "Date" and "SSDatetime"
|
||||
switch($this->db($k)) {
|
||||
case "Date":
|
||||
$meridiem = substr($v, strlen($v) - 2, strlen($v));
|
||||
$v = substr($v, 0, strlen($v) - 6);
|
||||
$record[$k] = date('Y-m-d', strtotime($v . ' ' . $meridiem));
|
||||
$v = preg_replace('/([ap]m)$/i', ' \\1', $v);
|
||||
$record[$k] = date('Y-m-d', strtotime($v));
|
||||
break;
|
||||
|
||||
case "Datetime":
|
||||
case "SSDatetime":
|
||||
$meridiem = substr($v, strlen($v) - 2, strlen($v));
|
||||
$v = substr($v, 0, strlen($v) - 6);
|
||||
$record[$k] = date('Y-m-d H:i:s', strtotime($v . ' ' . $meridiem));
|
||||
$v = preg_replace('/([ap]m)$/i', ' \\1', $v);
|
||||
$record[$k] = date('Y-m-d H:i:s', strtotime($v));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -159,6 +159,7 @@ class TableListFieldTest_Obj extends DataObject implements TestOnly {
|
||||
"B" => "Varchar",
|
||||
"C" => "Varchar",
|
||||
);
|
||||
static $default_sort = "A";
|
||||
|
||||
function D() {
|
||||
return $this->A . '/' . $this->B . '/' . $this->C;
|
||||
@ -174,6 +175,7 @@ class TableListFieldTest_CsvExport extends DataObject implements TestOnly {
|
||||
"A" => "Varchar",
|
||||
"B" => "Varchar"
|
||||
);
|
||||
static $default_sort = "A";
|
||||
}
|
||||
|
||||
class TableListFieldTest_TestController extends Controller {
|
||||
|
Loading…
x
Reference in New Issue
Block a user