Skip to content
Snippets Groups Projects

Issue #3505318 by macsim: datetime-local element is failing on Datetime::valueCallback()

Closed Issue #3505318 by macsim: datetime-local element is failing on Datetime::valueCallback()
2 unresolved threads
Closed Maxime Roux requested to merge issue/drupal-3505318:3505318-datetime-local-element-is into 11.x
2 unresolved threads

Closes #3505318

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 37
    38 /**
    39 * {@inheritdoc}
    40 */
    41 public function setUp(): void {
    42 parent::setUp();
    43
    44 $this->installEntitySchema('date_format');
    45 $this->installConfig(['system']);
    46 $this->formBuilder = $this->container->get('form_builder');
    47 }
    48
    49 /**
    50 * {@inheritdoc}
    51 */
    52 public function getFormId(): string {
  • Stephen Mustgrave
  • Stephen Mustgrave
  • Stephen Mustgrave
  • Stephen Mustgrave
  • Maxime Roux added 1 commit

    added 1 commit

    Compare with previous version

  • Maxime Roux added 1 commit

    added 1 commit

    Compare with previous version

  • catch @catch started a thread on the diff
  • 232 245 if ($element['#date_date_element'] != 'none') {
    233 246
    234 247 $date_format = $element['#date_date_element'] != 'none' ? static::getHtml5DateFormat($element) : '';
    248 // With a datetime-local input, the date value is always normalized to
    249 // the format Y-m-d\TH:i
    250 // @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/datetime-local
    251 // 'html_datetime' returned by static::getHtml5DateFormat($element) is not
    252 // a valid format.
    253 // @see https://www.drupal.org/project/drupal/issues/3505318
    254 if ($element['#date_date_element'] === 'datetime-local') {
    255 $date_format = DateFormat::load('html_date')->getPattern() . '\T' . DateFormat::load('html_time')->getPattern();
    • Maintainer

      I'm a bit confused why we need to load the date formats to get what are essentially hard-coded dates, but given we have these formats in core and they're locked that seems pre-existing and not something to change here.

    • Please register or sign in to reply
  • catch added 1 commit

    added 1 commit

    • 6ffe8864 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • closed

  • Please register or sign in to reply
    Loading