How do I create a time range form field?
Haven't tested this but if you install time field module you then could do this to simulate a range:

$form['from'] = [
  '#type' =&gt; 'time',
  '#title' =&gt; 'from',
];
$form['to'] = [
  '#type' =&gt; 'time',
  '#title' =&gt; 'to',
];