Estou fazendo um formulário próprio mas todo baseado no formulário do curso Aparentemente segui todas as instruções, mas continua dando erro na data (sou novo na plataforma e não sei se poderia estar tirando dúvidas visto que não estou usando exatamente o mesmo código do curso)
//mensagem de erro
NewInput.js:13 Uncaught TypeError: data.getTime is not a function
at new NewInput (NewInput.js:13)
at RegisterController.addRegister (RegisterController.js:30)
//classe construtura
class NewInput {
constructor(program, tipoInput, input, partnumber, ecode,descriptions, partquantity, nestquantity, serialnumber, sprint, data, status) {
this._program = program;
this._tipoInput = tipoInput;
this._input = input;
this._partnumber = partnumber;
this._ecode = ecode
this._descriptions = descriptions;
this._partquantity = partquantity;
this._nestquantity = nestquantity;
this._serialnumber = serialnumber;
this._sprint = sprint;
this._data = new Date(data.getTime());
this._status = status;
Object.freeze(this);
}
get program() {
return this._program;
}
get tipoInput() {
return this._tipoInput;
}
get input() {
return this._input;
}
get partnumber() {
return this._partnumber;
}
get ecode() {
return this._ecode;
}
get descriptions() {
return this._descriptions;
}
get partquantity() {
return this._partquantity;
}
get nestquantity() {
return this._nestquantity;
}
get serialnumber() {
return this._serialnumber;
}
get sprint() {
return this._sprint;
}
get dane() {
return new Date(this._data.getTime());
}
get status() {
return this._status;
}
get totalHourProg() {
var hourProgStandard = 4.5;
return this.partquantity * hourProgStandard;
}
get timeRemaining() {
let today = new Date();
return this.data - today;
}
};
//controller
class RegisterController {
constructor() {
let $ = document.querySelector.bind(document);
this._fieldProgram = $('#program');
this._fieldTipoInput = $('#tipoInput');
this._fieldInput = $('#input');
this._fieldPartnumber = $('#partnumber');
this._fieldEcode = $('#ecode');
this._fieldDescription = $('#description');
this._fieldPartquantity = $('#partquantity');
this._fieldNestquantity = $('#nestquantity');
this._fieldHourprog = $('#hourprog');
this._fieldHourremaining = $('#hourremaining');
this._fieldSerialnumber = $('#serialnumber');
this._fieldSprint = $('#sprint');
this._fieldDate = $('#dane');
this._fieldStatus = $('#status');
}
addRegister(event) {
event.preventDefault();
let data = new Date(...
this._fieldDate.value
.split("-")
.map((item, indice) => item - indice % 2)
);
let newInput = new NewInput (
this._fieldProgram.value,
this._fieldTipoInput.value,
this._fieldInput.value,
this._fieldPartnumber.value,
this._fieldEcode.value,
this._fieldDescription.value,
this._fieldPartquantity.value,
this._fieldNestquantity.value,
this._fieldHourprog.value,
this._fieldHourremaining.value,
this._fieldSerialnumber.value,
this._fieldSprint.value,
data,
this._fieldStatus.value
);
console.log(newInput);
}
}
obrigado desde já!