I am creating a node app where a user can select a bought date using the HTML input of: <input placeholder="Date Bought" class="textbox-n form-control" type="text" onfocus="(this.type='date')" onblur="(this.type='text')" id="bought" name="bought">
This is then stored to a mongodb using var bought = req.body.bought; and the user inputs a number of months into another HTML input that has name="warranty" I need to convert to a date using the bought date and then warranty months. How can I add these? I have tried this:
var bought = req.body.bought;
var warrantyMonths = req.body.warranty;
var warranty = bought.setMonth(bought.getMonth()+ warrantyMonths);
As per this guide