Drupal 7 date_popup timepicker only default value
I am currently using Drupal 7's date_popup. One of the problems I encountered was the default value not appearing if I've only selected the format as time-only.
I.e.
$form['start'] = array(
'#type' => 'date_popup',
'#title' => t('Start'),
'#default_value' => date("Y-m-d H:i:s", $start),
'#date_format' => "Y-m-d h:i A",
);
shows the correct default value, although it includes all the date stuff (I only want a timepicker actually). But if I change '#date_format' to a time-only format, i.e. this:
$form['start'] = array(
'#type' => 'date_popup',
'#title' => t('Start'),
'#default_value' => date("Y-m-d H:i:s", $start),
'#date_format' => "h:i A",
);
There is no more default value. How can I have a default value开发者_运维知识库 for date_popup for a time-only format?
There's a patch for the date popup module here which might be suitable
http://drupal.org/node/1037150
But it would appear that it's a bug introduced while adding relative functionality to time only fields.
精彩评论