Skip to content
Snippets Groups Projects

Issue #3361374: HTML 5 'datetime-local' element has incorrect format

Open tyler36 requested to merge issue/drupal-3361374:3361374-html-5-datetime-local into 11.x
@@ -5,8 +5,8 @@
use Drupal\Component\Utility\NestedArray;
use Drupal\Component\Utility\Variable;
use Drupal\Core\Datetime\DrupalDateTime;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Datetime\Entity\DateFormat;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Render\Attribute\FormElement;
use Drupal\Core\Security\DoTrustedCallbackTrait;
use Drupal\Core\Security\StaticTrustedCallbackHelper;
@@ -419,9 +419,11 @@ protected static function getHtml5DateFormat($element) {
return DateFormat::load('html_date')->getPattern();
case 'datetime':
case 'datetime-local':
return DateFormat::load('html_datetime')->getPattern();
case 'datetime-local':
return 'Y-m-d\TH:i';
default:
return $element['#date_date_format'];
}
Loading