How to find the difference between the return date and departure date in ReactJs jsx map loop.
JSON response:
{
departureDate: '2020-07-28',
returnDate: '2020-09-16',
}
Component
const DaysDiff = () => {
const days = 1000 * 60 * 60 * 24;
return(
Object.keys(datajson).map((key,index): ReactElement => (
<h2>{((datajson[key].returnDate) - (datajson[key].departureDate)) / days) } </h2>
)
)
}