How to have just the time picker in a bootstrap 3 date/time picker widget with an added string in format

前端 未结 1 1007
轮回少年
轮回少年 2021-01-26 20:49

My question refers to the following bootstrap 3 date time picker:

https://eonasdan.github.io/bootstrap-datetimepicker/

I have a bootstrap 3 date and time picker

1条回答
  •  佛祖请我去吃肉
    2021-01-26 21:20

    It's a bug of the datetimepicker, if you look at the code you will see that it internally uses the isEnabled function to determine which component to show. The isEnabled determines if the date picker should be shown checking if the format contains a D (case insensitive). Unfortunately, it does not takes in account string escaping [].

    If the format option does not contain Y, M, d and D, the component will work as expected, as shown in the following example:

    $('#datetimepicker').datetimepicker({
      defaultDate:'now',
      ignoreReadonly: true,
      format: '[abc:] LT'
    });
    
    
    
    
    
    
    
    
    


    I found that is a already known issue and there is a open pull request that tries to fix it. If you need, you can try to change the libary code locally with the code proposed by the pull request.

    0 讨论(0)
提交回复
热议问题