How can I disable future dates? I am developing a custom module, where I need to disable future dates in the date pop-up. How can I do this?
This can be achieved by adding an attribute max

$form['date'] = [
  '#title' =&gt; $this-&gt;t('Date'),
  '#type' =&gt; 'date',
  '#attributes' =&gt; [
    'type' =&gt; 'date',
    'min' =&gt; '-25 years',
    'max' =&gt; 'now',
  ],
  '#date_date_format' =&gt; 'd/m/Y',
];


Reference: https://api.drupal.org/comment/61733#comment-61733