How to restrict previous date display in custom forms? I created a custom module for a form which accepts from date and to date as user input. I would like to restrict the user from selecting a date prior to current date.

Code snippet of my code

$form['oneway']['from_date'] = array (
  '#type' =&gt; 'date',
  '#title' =&gt; t('From Date'),
  '#date_year_range' =&gt; '-80:0',
  '#required' =&gt; TRUE,
);


Can someone please help me out?
Approach to get today's date as Minimum date

Pass the JS options in '#datepicker_options'

$form['oneway']['from_date'] = array(
  '#title' =&gt; t('From Date'),
  '#type' =&gt; 'date_popup',
  '#date_format' =&gt; 'Y-m-d',
  '#date_year_range' =&gt; '-80:0',
  '#required' =&gt; TRUE,
  '#datepicker_options' =&gt; array(
    'minDate' =&gt; 0,
  ),
);



  minDate => 0 (Sets the min date to today's date)
  
  minDate => -1 (Sets the min date to yesterday's date)


More info: http://api.jqueryui.com/datepicker/#option-minDate