By default, prefix and suffix on an Bootstrap datetime picker element are hardcoded, and cannot be changed.
Element has the container as wrapper class and col-sm-6 as column class.

Any manually provided #prefix and #suffix will be ignored and overwritten.
In my opinion this is not a flexible solution, and developer must have a possibility to provide custom prefix and suffix.

Comments

turtletrail created an issue. See original summary.

turtletrail’s picture

Here is the patch that adds this possibility.
It's intended to not mess anything in the existing projects by providing the original prefix and suffix if none were provided manually.

digitalcatalyst’s picture

I confirm this patch solves the problem, when in a custom form, the hard coded prefix and suffix interfere with the layout. Manually removing from module makes the custom form layout perfect, but, edit a node which uses the datepicker, and this stops working.
Using the patch means setting #prefix=>'', #suffix=>'' on the custom form, layout works and the node edit still works.
Ive included my FAPI call in case there is another solution

$form['end_datetime'] = [
'#type' => 'bootstrap_date_time',
'#title' => 'Date/Time',
'#hour_format' => '24H',
'#allow_times' => '15',
'#disable_days' => [],
'#date_type' => 'datetime',
'#first_day' => 0,
'#default_value' => null !== $form_state->getValue('end_datetime'),
'#prefix' => '',
'#suffix' => ''
};

prashant.c’s picture

Status: Active » Needs work

@turtletrail

Please re-roll you patch using the changes in this issue https://www.drupal.org/project/bootstrap_datetime_picker/issues/3103343
or close this issue and put your changes combined in this issue as both are related ones.

fkatsukawa’s picture

Patch re-rolled and tested.

  • fkatsukawa committed a803ea5 on 8.x-1.x
    Issue #3106036 by turtletrail, fkatsukawa: Prefix and suffix are...

  • fkatsukawa committed a803ea5 on 2.0.x
    Issue #3106036 by turtletrail, fkatsukawa: Prefix and suffix are...
fkatsukawa’s picture

Status: Needs work » Fixed
fkatsukawa’s picture

Status: Fixed » Closed (fixed)