<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.
CodePudding user response:
Try this.
<button
onClick={() =>
console.log(
data.filter(
(element: apiData) =>
new Date(element.dataemissao) >= allDatesRange[0] &&
new Date(element.dataemissao) <= allDatesRange[allDatesRange.length - 1],
),
)
}
>
data filteres
</button>