mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-04 07:08:34 +02:00
MINOR added Rfc2822 method to SS_Datetime. Fixed bug where dates in DataObject would not set times.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@100032 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
2fb156a660
commit
f1cd60cbf9
@ -1013,9 +1013,9 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
|
|
||||||
// Add the class name to the base object
|
// Add the class name to the base object
|
||||||
if($idx == 0) {
|
if($idx == 0) {
|
||||||
$manipulation[$class]['fields']["LastEdited"] = SS_Datetime::now()->URLDate();
|
$manipulation[$class]['fields']["LastEdited"] = "'".SS_Datetime::now()->Rfc2822()."'";
|
||||||
if($dbCommand == 'insert') {
|
if($dbCommand == 'insert') {
|
||||||
$manipulation[$class]['fields']["Created"] = SS_Datetime::now()->URLDate();
|
$manipulation[$class]['fields']["Created"] = "'".SS_Datetime::now()->Rfc2822()."'";
|
||||||
//echo "<li>$this->class - " .get_class($this);
|
//echo "<li>$this->class - " .get_class($this);
|
||||||
$manipulation[$class]['fields']["ClassName"] = "'$this->class'";
|
$manipulation[$class]['fields']["ClassName"] = "'$this->class'";
|
||||||
}
|
}
|
||||||
@ -1057,9 +1057,9 @@ class DataObject extends ViewableData implements DataObjectInterface, i18nEntity
|
|||||||
$this->flushCache();
|
$this->flushCache();
|
||||||
|
|
||||||
if(!isset($this->record['Created'])) {
|
if(!isset($this->record['Created'])) {
|
||||||
$this->record['Created'] = SS_Datetime::now()->URLDate();
|
$this->record['Created'] = SS_Datetime::now()->Rfc2822();
|
||||||
}
|
}
|
||||||
$this->record['LastEdited'] = SS_Datetime::now()->URLDate();
|
$this->record['LastEdited'] = SS_Datetime::now()->Rfc2822();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write ComponentSets as necessary
|
// Write ComponentSets as necessary
|
||||||
|
@ -128,6 +128,10 @@ class Date extends DBField {
|
|||||||
if($this->value) return date('r', strtotime($this->value));
|
if($this->value) return date('r', strtotime($this->value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Rfc2822() {
|
||||||
|
if($this->value) return date('Y-m-d g:i:s', strtotime($this->value));
|
||||||
|
}
|
||||||
|
|
||||||
function Rfc3339() {
|
function Rfc3339() {
|
||||||
$timestamp = ($this->value) ? strtotime($this->value) : false;
|
$timestamp = ($this->value) ? strtotime($this->value) : false;
|
||||||
if(!$timestamp) return false;
|
if(!$timestamp) return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user