I havent been able to find much on the subject and I know im doing this completely wrong but Im attempting to do something similar to the following:
var position1 = raw_dates.indexOf(date1);
var position2 = raw_dates.indexOf(date2);
var i = 0;
while(i<=(officers.length-1)){
var tmp1 = 'array1_'+i;
var tmp2 = 'array2_'+i;
tmp1 = tmp1.slice(position1,position2);
tmp2 = tmp2.slice(position1,position2);
i++;
}
dates = raw_dates.filter(function(x){
return x >= date1 && x <= date2;
});
My goal here is to change the size of array1 and array2 for each officers. officers is an array and has values like officer_0, officer_1, etc. Each one of those has two arrays containing data relative to dates. Im trying to trim down my officer arrays to be in sync with my trimmed down dates array.
EDIT
dates = [20190101,20190102,20190103,20190104,20190105];
officers = ['joe', 'bob', 'bill', 'jeb'];
//joe
array1_0 = [1,2,3,4,5];
array2_0 = [2,4,6,8,10];
//bob
array1_1 = [1,2,3,4,5];
array2_1 = [2,4,6,8,10];
//bill
array1_2 = [1,2,3,4,5];
array2_2 = [2,4,6,8,10];
//jeb
array1_3 = [1,2,3,4,5];
array2_3 = [2,4,6,8,10];
//DESIRED OUTPUT IF DATE
//RANGE = 20190102-20190103
array1_X = [2,3];
array2_X = [4,6];
array_1, which in your example would yieldrrinstead of the dates you're looking for. I think you need to re-format your data to make the arrays properties of officer objects. Alternatively, maybe this is of some help: stackoverflow.com/questions/12149233/…