I'm using a date picker I created with the sly tool darsa.in and everything is perfect, except that if the user changes the days too fast JavaScript does not trigger the correct date for the function.
Is there a way for doing:
if (datepicker not active for x seconds)
Or is there a way to create a variable and trigger the function only if that variable does not change during x time? I need to give some time to JS so it does not trigger the function until the user is on the date he targets.
Some code follows below.
When the day of the day picker changes, I call loadDateMatches()
which loads all the matches into the HTML. But if you change, for example, very quickly between day 1 and day 5, it may stop loading the matches on day number 3.
I'm looking for a way to not trigger the function loadDateMatches()
until there has been some time without changing the date.
days.on('active', function (eventName) {
activeDate= this.rel.activeItem;
var logDate = new Date(d.getFullYear(), 0, activeDate + first + 1);
var startTime = new Date(logDate.getFullYear(), logDate.getMonth(), logDate.getDate(), 0, 0, 0);
DayBarConditions.startTime = startTime.getTime()/1000;
var endTime = new Date(logDate.getFullYear(), logDate.getMonth(), logDate.getDate(), 23, 59, 59);
DayBarConditions.endTime = endTime.getTime()/1000;
if (typeof loadDateMatches == 'function') {
loadDateMatches();
}
});