ajax call with possible dates as an object
Hi there,
I have an Object which comes from a Magento Controller with possible Dates for the Datepicker. I can loop through the object with an each() function but I can't access them to the Datepicker. I want to use the datepicker for picking a Date based on a shipping method which is chosen and the datepicker have to update with new dates given from the controller.
I tried e.g.
function setDatepicker(data) {
$('#myinput').pickadate({
disable: [
true,
$.each(data, function(index, value) {
new Date(value)
}
],
});
}
and
function setDatepicker(data) {
$('#myinput').pickadate({
disable: [
true,
data
],
)};
}
the Object looks like this:
(90) ["2019,1,26", "2019,1,27", "2019,1,28", "2019,2,1", "2019,2,5", "2019,2,6", "2019,2,7", "2019,2,8", "2019,2,12", "2019,2,13", "2019,2,14"]
and when I loop trough it with an each function it look like this: 2019,1,26 2019,1,27 2019,1,28 2019,2,1 2019,2,5 2019,2,6 2019,2,7 2019,2,8 2019,2,12 2019,2,13 2019,2,14
Is there any possibility to update it like this?
I think this is a general question as this is just an issue with the Date object and our API.
Can you provide a working codepen?