well, what I am doing is putting a date range with jquery, I know that it can be done with moment js but I wanted to try it in another way, in the end the whole procedure does it well only that when adding the max="0000-00 -00" in the date the input doesn't take it here is my code:
$("#fechaINICIO").change(function(){
var fechai = new Date($('#fechaINICIO').val());
var dias = 8;
fechai.setDate(fechai.getDate() + dias);
var fechamaxima = fechai.innerText = ('0' + fechai.getDate()).slice(-2) + '-' + ('0' + (fechai.getMonth()+1)).slice(-2) + '-' + fechai.getFullYear();
document.getElementById("fechafinal").setAttribute("max", fechamaxima);
console.log(fechamaxima);
});
and here is the input :
<div class="form-group">
<label>Fin</label>
<input type="date" max="" id="fechafinal" name="to_date" class="form-control" required>
</div>
Would I have to specify in some way that it is a data type or that it will be what fails?
Your code works, the issue is that the date has to be in UTC format, eg: 2012-01-01T11:57Z
In other words, you have to turn the maximum date