Skip to content
Snippets Groups Projects
Commit 1385caa9 authored by Sadashiv Dalvi's avatar Sadashiv Dalvi
Browse files

Fixing issue with webform value not submitted

parent df576719
No related branches found
No related tags found
No related merge requests found
File added
......@@ -109,6 +109,9 @@ class BootstrapDateTime extends DateBase {
$element['#default_value'] = ($element['#default_value']) ? DrupalDateTime::createFromTimestamp(strtotime($element['#default_value'])) : NULL;
}
}
if ($element['#type'] == 'bootstrap_date_time') {
$element['#default_value'] = ($element['#default_value']) ? DrupalDateTime::createFromTimestamp(strtotime($element['#default_value'])) : NULL;
}
}
......@@ -391,4 +394,24 @@ class BootstrapDateTime extends DateBase {
$date_formatter = \Drupal::service('date.formatter');
return $date_formatter->format($timestamp ?: \Drupal::time()->getRequestTime(), 'custom', $custom_format);
}
/**
* {@inheritdoc}
*/
protected function parseInputFormat(array &$element, $property) {
if (!isset($element[$property])) {
return;
}
elseif (is_array($element[$property])) {
foreach ($element[$property] as $key => $value) {
$timestamp = strtotime($value);
$element[$property][$key] = ($timestamp !== FALSE) ? $this->dateFormatter->format($timestamp, 'html_' . $this->getDateType($element)) : NULL;
}
}
else {
$timestamp = strtotime($element[$property]);
$element[$property] = ($timestamp !== FALSE) ? $this->dateFormatter->format($timestamp, 'custom', 'Y-m-d H:i' ) : NULL;
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment