code: public function validate($value){
  		$empty=false;
  
  		try{
  			$empty=$this->getOption('empty');
  		}
  		catch(ValueNotFoundException $e){
  			//ignore
  		}
  
  		if(!$value && $empty){
  			return null;
  		}
  
  		$d = \DateTime::createFromFormat('Y-m-d', $value);
  	    if($d && $d->format('Y-m-d') == $value);
  	    else
  			return 'Invalid date format.';
  
          return null;
  	}
docs: {@inheritdoc}