I am using the following code to display a date popup in my drupal 6 custom module.
$form['intelligence']['start_date'] = array(
'#type' => 'date_popup',
'#date_year_range' => '-100:+0',
'#description'=>'Start',
'#prefix' => '<div class="start_datefield_div"> ',
'#date_format' => 'Y-M-d',
'#default_value' => date('Y-M-d', time()),
'#suffix'=>'</div>'
);
But I am getting default date blank.
I have gone through Date popup form field doesn't show the default value correctly and string espected but array given in custom pop_date field #default_value , but no success .
Can anybody tell, what the issue is with this code? Actually I need $_POST['start_date']
as the default value. But for testing purpose I put date('Y-M-d', time())
'#default_value' => date('Y-m-d', $date)
. Notice the lower case 'm'; it's counter-intuitive but date_popup is expecting the default value in a very specific format, regardless of the format you've chosen for display