1

I want to add date picker with time in configuration section in my custom module.

I followed Webkul link

webkul link

But from this I can only able to see date picker time picker is not appearing. How I will add time picker?

Amit Bera
  • 77,456
  • 20
  • 123
  • 237
konika
  • 579
  • 2
  • 7
  • 23

1 Answers1

3

You should use the datetimepicker like this:

$html .= '<script type="text/javascript">
        require(["jquery", "jquery/ui"], function (jq) {
            jq(document).ready(function () {
                jq("#' . $element->getHtmlId() . '").datetimepicker( { dateFormat: "dd/mm/yy" } );
                jq(".ui-datepicker-trigger").removeAttr("style");
                jq(".ui-datepicker-trigger").click(function(){
                    jq("#' . $element->getHtmlId() . '").focus();
                });
            });
        });
        </script>';
// return datetime picker element

Result:

Result

Siarhey Uchukhlebau
  • 15,957
  • 11
  • 54
  • 83