Hi,
the setValue() method in Date class is
[code php]
function setValue($value) {
if( is_array( $value ) && $value['Day'] && $value['Month'] && $value['Year'] ) {
$this->value = $value['Year'] . '-' . $value['Month'] . '-' . $value['Day'];
return;
}
// Default to NZ date format - strtotime expects a US date
if(ereg('^([0-9]+)/([0-9]+)/([0-9]+)$', $value, $parts))
$value = "$parts[2]/$parts[1]/$parts[3]";
if($value) $this->value = date('Y-m-d', strtotime($value));
else $value = null;
}
But the lines
[code php]
// Default to NZ date format - strtotime expects a US date
if(ereg('^([0-9]+)/([0-9]+)/([0-9]+)$', $value, $parts))
$value = "$parts[2]/$parts[1]/$parts[3]";
do not work, because of the code
[code php]
if($value) $this->value = date('Y-m-d', strtotime($value));
So, if I set the date to '23/07/2007', then the date in DB is 0000-00-00.
P.S. Also the first condition in DateField::setValue() looks weird.