DateCompare.php 574 B

1234567891011121314151617181920212223
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once 'HTML/QuickForm/Rule/Compare.php';
  4. /**
  5. * Class HTML_QuickForm_Rule_DateCompare
  6. * @author Julio Montoya
  7. */
  8. class HTML_QuickForm_Rule_DateCompare extends HTML_QuickForm_Rule_Compare
  9. {
  10. /**
  11. * Validate 2 dates
  12. * @param array $values Array with the 2 dates.
  13. * @param $operator
  14. *
  15. * @return boolean true if the 2 given dates match the operator
  16. */
  17. function validate($values, $operator = null)
  18. {
  19. return api_strtotime($values[0]) < api_strtotime($values[1]);
  20. }
  21. }