最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - bootstrap-datetimepicker for bootstrap 4 - Stack Overflow

programmeradmin9浏览0评论

I want to use bootstrap-datetimepicker with bootstrap 4 but I have some problems.

For this purpose I changed something like:

  1. pull-right to float-right
  2. table-condensed to table-sm
  3. glyphicons to fontawesome

but it did not work :(

Demo

Can anyone help me for converting this project to new bootstrap version?

I want to use bootstrap-datetimepicker with bootstrap 4 but I have some problems.

For this purpose I changed something like:

  1. pull-right to float-right
  2. table-condensed to table-sm
  3. glyphicons to fontawesome

but it did not work :(

Demo

Can anyone help me for converting this project to new bootstrap version?

Share Improve this question edited Dec 4, 2017 at 7:25 beaver 17.6k2 gold badges43 silver badges68 bronze badges asked Dec 3, 2017 at 12:00 HamedFathiHamedFathi 3,9798 gold badges39 silver badges78 bronze badges 1
  • 4 eonasdan-datetimepicker does not support bootstrap v.4, the new version of the library is called tempus dominus – VincenzoC Commented Dec 3, 2017 at 16:30
Add a ment  | 

3 Answers 3

Reset to default 12

It's ok for me with Bootstrap4, what is your problem ? (sorry for my bad english :')

Edit lines with ".in"collapse to ".show" and icons

DEMO

We've made a fork with the fixes with detail documentation:

Forked Repository:

  • TechnoVista Limited/Bootstrap 4 DateTimePicker - Github

Usage:

jQuery(document).ready(function($) {
    if (window.jQuery().datetimepicker) {
        $('.datetimepicker').datetimepicker({
            // Formats
            // follow MomentJS docs: https://momentjs./docs/#/displaying/format/
            format: 'DD-MM-YYYY hh:mm A',

            // Your Icons
            // as Bootstrap 4 is not using Glyphicons anymore
            icons: {
                time: 'fa fa-clock-o',
                date: 'fa fa-calendar',
                up: 'fa fa-chevron-up',
                down: 'fa fa-chevron-down',
                previous: 'fa fa-chevron-left',
                next: 'fa fa-chevron-right',
                today: 'fa fa-check',
                clear: 'fa fa-trash',
                close: 'fa fa-times'
            }
        });
    }
});

Credits:

Thanks to Eonasdan for the awesome library. Thanks to 非良 (wgbbiao) for their fork too. Thanks to Camille Anelli's blog for the reminder about the icons.

@Stéphanie your demo more than made up for the short English explanation. Thanks!

For anyone else that might need to solve this, here go a very specific directions: (All based on @Stéphanie's answer below - checkout her demo.) There are four strings you need to search in the code:

"collapse in":"
g=f.find(".in")
.collapse:not(.in)
(g.removeClass("in"),h.addClass("in")

and in each case replace   in   with;   show   so that it will look like the following. Save the file and the calendar should work. Good luck!

"collapse show":"
g=f.find(".show")
.collapse:not(.show)
(g.removeClass("show"),h.addClass("show")

发布评论

评论列表(0)

  1. 暂无评论