API page: https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21...

Enter a descriptive title (above) relating to class Date, then describe the problem you have found:

In the example that is provided, there is a missing ' in the default_value.

$form['expiration'] = [
      '#type' => 'date',
      '#title' => $this->t('Content expiration'),
      '#default_value' => 2020-02-05',
    ];

Should be:

$form['expiration'] = [
      '#type' => 'date',
      '#title' => $this->t('Content expiration'),
      '#default_value' => '2020-02-05',
    ];

Patch provided for code. Documentation page should be updated also.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tim-diels created an issue. See original summary.

cindytwilliams’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
45.73 KB
49.87 KB

Patch applied cleanly and added the missing ' to the default value in the example. Screenshots attached. Marking RTBC.

updated example in date.php code

alexpott’s picture

Version: 8.8.x-dev » 8.7.x-dev
Status: Reviewed & tested by the community » Fixed

@cindytwilliams thank you for reviewing this issue! The automated testing infrastructure tells us whether the patch applies, so we do not need people to review that.

Committed and pushed 683dda01d7 to 8.8.x and f2d39d5d3b to 8.7.x. Thanks!

  • alexpott committed 683dda0 on 8.8.x
    Issue #3078633 by tim-diels, cindytwilliams: Documentation fix date...

  • alexpott committed f2d39d5 on 8.7.x
    Issue #3078633 by tim-diels, cindytwilliams: Documentation fix date...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.