0

I am trying to create a datepicker, and I need to disable multiple dates from it.

I managed to disable one date by doing this :

$attributes = array(
                'id'    => 'end',
                'name'  => 'end',
                'data-provide'          => "datepicker",
                'data-date-format'      => "dd/mm/yyyy",
                'data-date-dates-disabled'  => "14/07/2017",
                'value' => date(mdate('%d/%m/%Y')),
        );
$html .= form_input($attributes);

However, when I try to add multiples dates to the line data-date-dates-disabled' => "14/07/2017",, it does not work. I have tried doing "14/07/2017,15/07/2017", "[14/07/2017,15/07/2017]", "14/07/2017 15/07/2017", but nothing seems to work.

Does anyone know how to do that ?

Thank you,

GBathie
  • 121
  • 4

2 Answers2

1

Ok, it was indeed a bug, I had to upgrade my bootstrap-datepicker to > v1.7.0 where that bug was fixed

GBathie
  • 121
  • 4
0

I have tried this one in jsfiddle, seems working fine. give it a shot.

Jquery UI datepicker. Disable array of Dates

Kirsten Phukon
  • 314
  • 3
  • 17
  • thank you, I'll give it a try if I can't find a php based solution – GBathie Jul 10 '17 at 09:58
  • from where you are getting the dates which you will disable in the datepicker?? – Kirsten Phukon Jul 10 '17 at 10:48
  • If you are getting the dates from db. You can get the dates in an array and put it the js array and you see the magic. You can try it here: http://jsfiddle.net/arunpjohny/CxNNh/1/ – Kirsten Phukon Jul 10 '17 at 10:52
  • Yes I get those from the db. Am I supposed to include the code as it is or wrap it in a function ? Thanks for your help – GBathie Jul 10 '17 at 12:31