Y-m-d format subtracting when set as value

Y-m-d format subtracting when set as value

For the life of me I could not understand why when I was storing today's date and then setting it as a value it was coming up as 199* instead of 2018-07-0*.

How do I set the value of a text input for today's date in the Y-m-d format without it subtracting?

HTML

<input type="text" id="delivery_date" name="delivery_date" placeholder="" data-mask="9999-99-99" class="form-control" size="4" required>

JS

document.getElementById('delivery_date').value =  user[0].delivery_date;