prescription.prescriptionDate gives me a proper date object
prescription.prescriptionExpirationDate gives me a number (7, 14)
Please keep in mind I am trying to get this done in-line.
I am trying to add the number 7 or 14 into the date object and it should give me a new date object with the 7 or 14 days added into it. I am definitely doing something wrong as I get this error:
TypeError: Cannot read property 'getDate' of undefined
Here's my code:
<Typography variant="body2" component="p">
{new Date(prescription.prescriptionDate).setDate(prescription.prescriptionDate.getDate() + prescription.prescriptionExpirationDate).toDateString()}
</Typography>
Here's the code that works, to prove that I do get infact the prescription.prescriptionDate value correctly.
<Typography variant="body2" component="p">
{new Date(prescription.prescriptionDate).toDateString()}
</Typography