I made a simple web app to use at work which takes in a specific date and returns a date X number of days in the future. Works perfect on android. Safari seems to not be taking in the input values best I can figure. Safari will only return undefined NaN. The HTML checks out on the W3C validator. I also tried 'use strict' and let vs const for variables. I'm now clueless and tired of banging my head.
<head>
<style>
body {
background-color: lightblue;
text-align: center;
}
button {
margin: 50px 0 25px;
}
</style>
</head>
<body>
<div>
<h3>Welcome to the</h3>
<h1>Ko-culator</h1>
</div>
<div>
<p>Enter last fill / pick up date:</p>
<input type="text" id="lastFillDate" placeholder="M-D-YY" style="text-align: center">
<p>Enter day supply:</p>
<input type="text" id="daySupply" placeholder="30, 60, etc" style="text-align: center">
</div>
<div>
<button type="submit" onClick="getNextFill()">Next Fill Date</button>
</div>
<div>
<p class="date-due"></p>
</div>
<script>
function getNextFill() {
const days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
const lastFillDate = new Date(document.querySelector('#lastFillDate').value);
const daySupply = document.querySelector('#daySupply').value;
const dayOfMonth = lastFillDate.getDate();
lastFillDate.setDate(dayOfMonth + Number.parseInt(daySupply));
const nextFillDate = days[lastFillDate.getDay()] + " " + (lastFillDate.getMonth() + 1) + "-" + lastFillDate.getDate() + "-" + lastFillDate.getFullYear();
document.querySelector('.date-due').innerHTML = 'Next fill is due on: <br/><br/>' + nextFillDate;
};
</script>
</body>