Drupal Answers Asked by Lorenzo De Bie on October 26, 2021
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,
),
);
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;
}
}
Answered by Naveen on October 26, 2021
You may find this one helpful.
Answered by Virang Jethva on October 26, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP