3
I have a date form, and I need to generate its 'min' and 'max' according to the current date. I made a function that calculates this date and arrow it in the form. The problem is that the value of the day is coming with 1 house and in html I need two houses. Follow the function:
function getDataMinima(){
var dataMinima = new Date();
dataMinima.setFullYear(dataMinima.getFullYear()-130);
var dataForm = dataMinima.getFullYear() + '-' + dataMinima.getMonth() + '-' + dataMinima.getDate();
console.log("entrou na função minima, data calculada:"+dataForm);
var dataMaxima = new Date();
dataMaxima.setFullYear(dataMaxima.getFullYear()-5);
var dataMaximaForm = dataMaxima.getFullYear() + '-' + dataMaxima.getMonth() + '-' +dataMaxima.getDate();
console.log("Entrou na funcao maxima, data calculada:"+dataMaximaForm);
$("#campodata").attr({
"min" : dataForm
});
}
My problem is that when this value is passed to html, I get: '1888-11-3', and '3' instead of '03' causes the rule to be ignored, there is some way to format it?