3
I have 3 functions, to make the date range filter in a range of 2.
So, I have a start date and an end date, and within these two dates he searches a table within his trs and tds such dates that will be in this range.
The functions used to make this range (which is gurdado in an array):
// prototype of dates
Date.prototype.addDays = function(days) {
var dat = new Date(this.valueOf())
dat.setDate(dat.getDate() + days);
return dat;
}
//GET DATES INTERVAL FUNCTION
function getDates(startDate, stopDate) {
var dateArray = new Array();
var currentDate = startDate;
while (currentDate <= stopDate) {
dateArray.push( new Date (currentDate) )
currentDate = currentDate.addDays(1);
}
return dateArray;
}
And here where the change takes place that triggers these functions and within it I want you to look for that range of dates that I need:
$("#start").keydown(function(event) {
var d1 = new Date($(this).val());
var d2 = new Date($("#end").val());
console.log(getDates(d1,d2));
});
$("#end").keydown(function(event) {
var d1 = new Date($("#start").val());
var d2 = new Date($(this).val());
console.log(getDates(d1,d2));
});
What is your question?
– Rodrigo Manguinho
I got it, thanks.
– Fabio William Conceição
hello @Fabiowilliamconceição, can share with us how you solved? so in the future someone can get helped with your question.
– h3nr1ke
I posted the solution
– Fabio William Conceição