RydelHouse
RydelHouse

Reputation: 362

Multiple date select with Eonasdan/bootstrap-datetimepicker

It is possible to select multiple dates and somehow select these date with jquery?

I am using this widget: https://github.com/Eonasdan/bootstrap-datetimepicker

Upvotes: 0

Views: 5070

Answers (2)

Aadam
Aadam

Reputation: 1541

This might not be right but it worked for me, to preload selected days, can try using existing classes.

function popCalander($ele, days){ //$ele is datetimepicker field, days is array with values in MM/DD/YYYY format
    for(var i=0;i<days.length;i++){
        $x=$ele.parent().find('*[data-day="'+days[i]+'"]');
        $x.addClass('active');
        $x.children().eq(0).addClass("bg-info"); 
    }
}

I would call that function as below

   $(".datetimepicker.reckoDate").focus(function(){
        popCalander($(".datetimepicker.reckoDate"),reckDays);
    });
$(".datetimepicker.reckoDate").on('dp.update', function(e){ // when you navigate within calendar
        popCalander($(".datetimepicker.reckoDate"),reckDays);
    });

Upvotes: 0

Fudgy
Fudgy

Reputation: 165

At the moment this feature is not implemented in the bootstrap-datetimepicker from Eonasdan.

A new request has been made to implement this functionality in february but so far there have been no updates on the matter. You can check the issue on github via: https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1465

You can however do multiple date selections with this bootstrap datepicker: http://bootstrap-datepicker.readthedocs.io/en/latest/index.html

Hope this helps!

Upvotes: 0

Related Questions