I have a form with 2 input fields of the type date (date1 and date2).
I have different buttons. If you click on these buttons, values should be entered in the form fields.
When the button is clicked, the current date should be inserted in the "date2" field. The current date minus 3 days should be inserted in the "date1" input field.
The date must be in the format "2018-01-22".
The other buttons are similar, only that a different number of days should be deducted.
I know that I need java script for this. Unfortunately, I don't know anything about it.
<div class="form-group col-6 col-md-4 col-lg-3">
<label for="datumvon" class="col-form-label">Datum von: </label>
<input type="date" class="form-control ml-2 col-6" id="datumvon">
</div>
<div class="form-group col-6 col-md-4 col-lg-3">
<label for="datumbis" class="col-form-label">Datum bis: </label>
<input type="date" class="form-control ml-2 col-6" id="datumbis">
</div>
<button type="button" class="btn btn-outline-dark">3 Tage</button>
<button type="button" class="btn btn-outline-dark">7 Tage</button>
<button type="button" class="btn btn-outline-dark">14 Tage</button>
<button type="button" class="btn btn-outline-dark">30 Tage</button>
<button type="button" class="btn btn-outline-dark">90 Tage</button>