1
Problem
I need to filter a string date array
example:
data = [[user1, 20/11/2019], [user1, 25/05/2019], [user1, 27/11/2019]]
Where the user selects the name the month "11" and the year "2019", in case the return would be:
"20/11/2019", "27/11/2019"
Code
var funcionarioId ="user1"
var month = "11"
var year = "2019";
var dataFiltered = data.filter(function(item){return item[1] === funcionarioId &&
item[3] === month &&
item[3] === year });
I believe I have to find the positions where the month and year are and apply the filter.
This and the structure copied directly from my console.log() [[1, 134, DIOGO, 03/12/2019, first, 2, 28/11/2019 09:43:23], [2, 131, ALEISIO, 13/11/2019, Second, 33, 28/11/2019 09:49:57], [3, 134, DIOGO, 25/11/2019, third, 2, 28/11/2019 09:43:23], [4, 134, DIOGO, 15/12/2019, Fourth, 2, 28/11/2019 09:43:23]]
– user2916405