function calendar_systems_date_validate in Calendar Systems 6.3
Same name and namespace in other branches
- 8 calendar_systems.module \calendar_systems_date_validate()
- 6 calendar_systems.module \calendar_systems_date_validate()
- 7.3 calendar_systems.module \calendar_systems_date_validate()
- 7 calendar_systems.module \calendar_systems_date_validate()
- 7.2 calendar_systems.module \calendar_systems_date_validate()
Validates date fields considerign the acitve calendar system
1 string reference to 'calendar_systems_date_validate'
- calendar_systems_form_alter in ./
calendar_systems.module - Implementation of hook_form_alter(). Optionally record all form submissions, for later use in building distributions
File
- ./
calendar_systems.module, line 347
Code
function calendar_systems_date_validate($element, &$form_state) {
if (!empty($element['#value'])) {
// form_error($element, t('This field is required.'));
$v = $element['#value'];
$calendar = calendar_systems_get_calendar_instance();
$a = preg_replace('/([0-9]+\\-[0-9]+\\-[0-9]+) (.*)/si', '$1', $v);
$b = preg_replace('/([0-9]+\\-[0-9]+\\-[0-9]+) (.*)/si', '$2', $v);
$v = $calendar
->strToTimestamp("{$a} 10:10:10");
$v = date("Y-m-d {$b}", $v);
form_set_value($element, $v, $form_state);
}
}