I am facing an issue with javascript dates. I want to comparing start date and end date
JSON data and show in specific slot newprevious, newcurrent, newfirstdate and newseconddate
react component
i tried but my condition is not working
<div class="row">
{this.state.data && this.state.data.length
? // this.state.data[index].start_date.toString() > this.state.newprevious
// this.state.data[index].start_date.toString() > this.state.newcurrent
// this.state.data[index].start_date.toString() > this.state.newfirstdate
// this.state.data[index].start_date.toString() > this.state.newseconddate
this.state.data.map(
({ cust_full_name, full_name, start_date }, index) => (
<div class="row" key={index}>
slot: {index + 1}
<p>{start_date}</p>
<p>{cust_full_name}</p>
</div>
My working demo:
https://codesandbox.io/s/priceless-bird-ue3iu?file=/src/App.js
my code output:
just match start date and end date
JSON data and show in specific previous , current , first and second date
slot
expected output:
what i should do? please help me out?