0

Is it possible to set the minimum and maximum values of the timepicker in a date_popup field? I use this code for the field, but something like 'minTime' is not working.

  $form['fetch_date'] = array(
    '#type' => 'date_popup',
    '#description' => t('Datum waarop u uw bestelling wil ophalen.'),
    '#required' => TRUE,
    '#title' => 'Afhaal Datum',
    '#datepicker_options' => array(
      'minDate' => 0,
    ),
  );
  • You many find help from this post – Jimmy Ko Jul 14 '16 at 14:04
0

You may find this one helpful.

Datepicker: minDate and maxDate

0

try this code

function hook_form_views_exposed_form_alter(&$form, $form_state, $form_id) {

  switch ($form_state['view']->name) {
  case 'my_view_name':
    // the Date object works only with this date format:
    $datemask = 'Y-m-d'; 
    $form['field_date_value']['min']['#default_value'] = date($datemask, time()-30*86400);
    $form['field_date_value']['max']['#default_value'] = date($datemask);
    break;

    $datemask = 'd/m/Y';
    $form['field_date_value']['min']['#date_format'] = $datemask;
    $form['field_date_value']['max']['#date_format'] = $datemask;
  }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.