时间类型样式

TimeType styling

我正在尝试使用 symfony 表单在 Symfony 3.4 中设置我的输入字段的样式一段时间(仅限小时和分钟)。我正在尝试使用时钟选择器,但我不知道我哪里错了。如果有人可以帮助我或有更好的解决方案。我已经下载并包含我的 js 和 css 到 web 文件夹中。

我现在正在努力做到这一点:

我的树枝:

<div class="form-group col-md-4">
   <label for="time_for_cooking">Време за готвене(минути):</label>
      {% if form_errors(form.recipeCookingTime) %}
          {{ form_widget(form.recipeCookingTime, { 'attr': {'class': 'form- control clockpicker-control clockpicker is-invalid'} }) }}
              <div class="col">
                 <small  class="text-danger">
                     {{ form_errors(form.recipeCookingTime) }}
                 </small>
              </div>
      {% else %}
          {{ form_widget(form.recipeCookingTime, { 'attr': {'class': 'form control clockpicker-control clockpicker'} }) }}
      {% endif %}
</div>

我的RecipeType.php

->add('recipeCookingTime', TimeType::class)

文件准备就绪

   <script>
      $(document).ready(function() {
        ('.clockpicker').clockpicker();
      } );
   </script>

及其生成的内容,我认为问题是这些选择被生成

在您的 FormType 中,您必须将 html5- 属性设置为 false 才能获得输入。 看这里https://symfony.com/doc/current/reference/forms/types/time.html#html5