You are here

function _commerce_pricelist_date_validate in Commerce Pricelist 7

Validation handler, parses string as date

1 string reference to '_commerce_pricelist_date_validate'
commerce_pricelist_item_form in includes/commerce_pricelist.admin.inc
Form function to create an commerce_pricelist_list entity.

File

includes/commerce_pricelist.admin.inc, line 698
Summary

Code

function _commerce_pricelist_date_validate($element) {
  if (!empty($element['#value'])) {
    if (!strtotime($element['#value'])) {
      form_set_error($element['#name'], t('You have to specify a valid date.'));
    }
    if (strlen($element['#value']) < 10) {
      form_set_error($element['#name'], t('You have to specify a valid date.'));
    }
  }
}