<button
onClick={() =>
console.log(
data.filter(
(element: apiData) =>
new Date(element.dataemissao) >= allDatesRange[0] &&
new Date(element.dataemissao) <= allDatesRange[length - 1],
),
)
}
>
data filteres
</button>
It's working when I try get just dates that are bigger than the first value of allDatesRange array.
allDatesRangeand make sure that the last date is greater than the first date? If the resulting array is empty it just means your filter condition isnt passing on any of the items