21288 Posts in 5733 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 950 Views |
-
TableListField: Field Casting with Date->Nice

8 December 2010 at 2:15pm Last edited: 8 December 2010 2:23pm
hi,
stumbled about a problem with fieldcasting in the tablelistfield. If i define a field casting for a Date field like this:
$fields['DepartureDate'] = array('title' => 'Departure Date',
'formatting' => '$value',
'casting' => 'Date->Nice');and there are empty values in the Result of the TableListField´s SourceQuery, the empty values are casted as well which results in wrong dates: " 01/01/1970" .
It seems that the TableListField always tries to "Cast" a fields value even if its value is empty.
TableListField.php
Line: 1357-1362// casting
if(array_key_exists($fieldName, $this->parent->fieldCasting)) {
$value = $this->parent->getCastedValue($value, $this->parent->fieldCasting[$fieldName]);
} elseif(is_object($value) && method_exists($value, 'Nice')) {
$value = $value->Nice();
}is there a way to avoid that empty values are casted in the TableListField?
thanks in advance
matze
| 950 Views | ||
|
Page:
1
|
Go to Top |

