DateTimeRule.php 519 B

12345678910111213141516171819202122232425
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once 'HTML/QuickForm/Rule.php';
  4. /**
  5. * Class DateTimeRule
  6. * @author Julio Montoya
  7. */
  8. class DateTimeRule extends HTML_QuickForm_Rule
  9. {
  10. /**
  11. * Check a date
  12. *
  13. * @param string $date example 2014-04-30 18:00
  14. * @param array $options
  15. *
  16. * @return boolean True if date is valid
  17. * @see HTML_QuickForm_Rule
  18. */
  19. public function validate($date, $options)
  20. {
  21. return api_is_valid_date($date, 'Y-m-d H:i');
  22. }
  23. }