I only have a basic understanding of JavaScript, and I have spent a long time researching and trying to find a solution, I have seen some that came close on her, but they either dealt with a different issue or I was unable to implement the solution with the information provided.
THE PROBLEM;
I have a form that a user can pick a date from, and a submit button. I want to collect the submitted date and then populate several "fields" with new dates which are - 180 days, -165 days, -150 days etc.
So far I have managed to collect the input date and been able to place that date into the fields , but I can't get the subtract x number of days to work.
Script is below and live preview is here (date picker only seems to work on chrome) http://jsfiddle.net/RobLondon/fnsa22r2/1/
I would be grateful for any help you could provide.
Thanks!
<script type="text/javascript">
"use strict";
document.getElementById('inc-date').addEventListener('submit', calcdates);
function calcdates(event) {
event.preventDefault();
var incDate = document.getElementById('inc-date-selected').value;
var incdateresult = (incDate);
document.getElementById("180-days").innerHTML = incdateresult - 180;
document.getElementById("165-days").innerHTML = incdateresult - 165;
}