How to change variable data in glDatepicker?

1

Good morning community of programmers, I have a problem and it is the following, I have the following code:

$(document).ready(function(){
    $('#mydate').glDatePicker(
    {
       showAlways: false,
       hideOnClick: true,
       allowMonthSelect: false,
       allowYearSelect: false,
       // prevArrow: '',
       // nextArrow: '',
       selectedDate: new Date(2018, 05, 17),

       selectableDates: [
           { date: new Date(2018, 05, 20) },
           { date: new Date(2018, 05, 25) }
       ]

    });
});

and I want to replace the values of the date of

selectableDates: [
    { date: new Date(2018, 05, 20) },
    { date: new Date(2018, 05, 25) }
]

Here I would like to place dates that I bring from a form, for example, that the form comes something like this

var fecha = '{ date: new Date(2018, 05, 19) }, { date: new Date(2018, 05, 20) }'

and that this variable when inserted into selectableDates take me those dates. I've done it but it does not work for me. I would really appreciate all of you guys, I know it should be something simple but I'm a bit of a novice in this.

Thank you very much.

    
asked by luis_gomez 17.05.2018 в 19:10
source

1 answer

0

Try it like this:

var fecha = [
    { date: new Date(2018, 05, 19) },
    { date: new Date(2018, 05, 20) }
];
$(document).ready(function(){
  $('#mydate').glDatePicker(
  {
     showAlways: false,
     hideOnClick: true,
     allowMonthSelect: false,
     allowYearSelect: false,
     // prevArrow: '',
     // nextArrow: '',
     selectedDate: new Date(2018, 05, 17),

     selectableDates: fecha

  });
});
    
answered by 17.05.2018 в 19:51