Skip to content
Snippets Groups Projects
Commit bf65be54 authored by goujonpa's avatar goujonpa
Browse files

datefield qui pète sa race

parent a4e7aaf0
No related branches found
No related tags found
No related merge requests found
......@@ -13,11 +13,27 @@ class DateField extends Field
public function validate()
{
$ret = true;
$this->value = $_POST[$this->name];
return true;
$year = substr($this->value, 0, 4);
$month = substr($this->value, 6, 2);
$day = substr($this->value, 9, 2);
$today = getdate();
if ($year < $today[year]) {
$ret = false;
} else if ( $year == $today[year] && $month < $today[mon] ){
$ret = false;
} else if ( $year == $today[year] && $month == $today[mon] && $day < $today[day]){
$ret = false;
}
return ret;
}
public function show() {
return $this->value;
$year = substr($this->value, 0, 4);
$month = substr($this->value, 6, 2);
$day = substr($this->value, 9, 2);
$html = $day.'-'.$month.'-'.$year;
return $html;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment