Issue
When I tried to block an array of individual dates, it's not blocking but when I try using some date range I am able to block the dates.
Below mentioned code is working as I am passing:
blocked_dates.push({ from: [2020, 4-1, 17], to: [2020, 5-1, 17], inverted: true });
@foreach($available_dates_arr as $adate)
available_dates.push({from:new Date({{ date("Y", strtotime($adate['start'])) }}, {{ date("n", strtotime($adate['start'])) }}-1, {{ date("j", strtotime($adate['start'])) }}), to:new Date({{ date("Y", strtotime($adate['end'])) }}, {{ date("n", strtotime($adate['end'])) }}-1, {{ date("j", strtotime($adate['end'])) }})});
@endforeach
blocked_dates.push({ from: [2020, 4-1, 17], to: [2020, 5-1, 17], inverted: true });
var $input = $('.datepicker').pickadate({
disable: available_dates,
min: min_date,
selectMonths: true,
selectYears: true,
format: 'dd-mmm-yy'
});
picker = $input.pickadate('picker');
if (blocked_dates && blocked_dates.length) {
picker.set('enable', blocked_dates);
}
But when I pass blocked_dates.push([2020, 4-1, 17, 'inverted']);
its not blocking the dates.
Ref : pickadate.js
Thanks in advance :)
Solution
After trying a lot i came up with idea and did the same way, what i did for any date range.
So if i have to block any individual date, then i am passing the same date to both from and to.
blocked_dates.push({ from: [2020, 4-1, 17], to: [2020, 4-1, 17], inverted: true });
blocked_dates.push({ from: [2020, 5-1, 20], to: [2020, 5-1, 20], inverted: true });
I know its not the way to block individual date what they mentioned in documents but it works for me.
Answered By - Prafful Panwar
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.