I'm using PickMeUp calendar to filter the events list based on user date pick.
Here is the fiddle: https://jsfiddle.net/Lkpmczte/1/
I have no idea what I'm doing wrong. Here's an excerpt:
let startDay;
let endDay;
let result;
pickmeup(element);
element.addEventListener("pickmeup-change", function(e) {
startDay = e.detail.formatted_date[0];
endDay = e.detail.formatted_date[1];
result = data.filter(function(obj) {
return obj.date >= startDay && obj.date <= endDay;
});
getDay();
});
let getDay = () => {
return startDay === endDay ?
console.log(startDay) :
console.log(`${startDay} - ${endDay}`);
};
btn.addEventListener("click", () => {
console.log(result);
});
But it turns back an empty array...
I would appreciate any kind of help :) Thanks in advance!
Solved. I had a typo in date format. I used dashes when I should've used slashes.