public function index02Action() { echo "<h3 style='color:red;font-weight:bold'>" . __METHOD__ . "</h3>"; $validator = new \Zend\Validator\Date("Y.m.d"); $input = "1992-11-17"; $input = "1992.01.17"; if (!$validator->isValid($input)) { $message = $validator->getMessages(); echo current($message); } else { echo "ok"; } return false; }
public function testErrorShowTwice() { $element = new Element\Date('birth'); $element->setFormat('Y-m-d'); $element->setValue('2010-13-13'); $validator = new \Zend\Validator\Date(); $validator->isValid($element->getValue()); $element->setMessages($validator->getMessages()); $markup = $this->helper->__invoke($element); $this->assertEquals(2, count(explode("<ul><li>The input does not appear to be a valid date</li></ul>", $markup))); }