Better handling of dates when registering children
This commit is contained in:
@@ -21,7 +21,7 @@ class Model_Child extends ORM {
|
||||
|
||||
public function filters() {
|
||||
return Arr::merge(parent::filters(),array(
|
||||
'dob'=>array(array('strtotime', array(':value'))),
|
||||
'dob'=>array(array(array($this,'date'), array(':value'))),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -53,6 +53,10 @@ class Model_Child extends ORM {
|
||||
return $format == '%w' ? sprintf('%02dw',$dob->diff($today)->days/7) : $dob->diff($today)->format($format);
|
||||
}
|
||||
|
||||
public function date($value) {
|
||||
return is_numeric($value) ? $value : strtotime($value);
|
||||
}
|
||||
|
||||
public function date_enrol_min() {
|
||||
$dob = $this->_dob();
|
||||
$dob->add(new DateInterval('P'.$this->_start));
|
||||
|
Reference in New Issue
Block a user