mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
BUGFIX: Don't make blank dates show 1/1/1970
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@66891 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
1aeaed7fc4
commit
025d2b2498
@ -99,8 +99,11 @@ class DateField_Disabled extends DateField {
|
|||||||
protected $disabled = true;
|
protected $disabled = true;
|
||||||
|
|
||||||
function setValue($val) {
|
function setValue($val) {
|
||||||
if($val && $val != "0000-00-00") $this->value = date('d/m/Y', strtotime($val));
|
if(is_string($val) && preg_match('/^([\d]{2,4})-([\d]{1,2})-([\d]{1,2})/', $val)) {
|
||||||
else $this->value = '('._t('DateField.NODATESET', 'No date set').')';
|
$this->value = preg_replace('/^([\d]{2,4})-([\d]{1,2})-([\d]{1,2})/','\\3/\\2/\\1', $val);
|
||||||
|
} else {
|
||||||
|
$this->value = $val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function Field() {
|
function Field() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user