Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

129
Visualizações
conflit where adding second to a Date in javascript and angular

i am trying to add second to a date.

i try:

var g = this.endTime;

console.log(g); // output : Wed Sep 15 2021 15:35:00 GMT+0300 (Eastern European Summer Time)

this.endTime = null;

this.startTime = null;

this.startTime = new Date(g.setSeconds(g.getSeconds() + this.timeFromGoogle));

console.log(this.startTime); // output: Wed Sep 15 2021 15:42:57 GMT+0300 (Eastern European Summer Time)

var temp = this.startTime;

console.log(temp); // output: Wed Sep 15 2021 15:42:57 GMT+0300 (Eastern European Summer Time)

this.endTime = new Date(temp.setSeconds(temp.getSeconds() + (resp.data.locations[0].stay_limit * 60)));

console.log(this.endTime); // output: Wed Sep 15 2021 15:45:57 GMT+0300 (Eastern European Summer Time)

console.log(this.startTime); // output: Wed Sep 15 2021 15:45:57 GMT+0300 (Eastern European Summer Time)

console.log(temp); // output : Wed Sep 15 2021 15:45:57 GMT+0300 (Eastern European Summer Time)

this.timeFromGoogle = number (second).

resp.data.locations[0].stay_limit = number(minute).

As we see startTime work fine in begining, and endTime also but:

after adding this:

this.endTime = new Date(temp.setSeconds(temp.getSeconds() + (resp.data.locations[0].stay_limit * 60)));

this.startTime change, and his same as endTime value.

to fix this i use temp to store startTime on it to use temp in endTime, but also not work.

output should be:

startTime: Wed Sep 15 2021 15:42:57 GMT+0300 (Eastern European Summer Time).

endTime: Wed Sep 15 2021 15:45:57 GMT+0300 (Eastern European Summer Time).

i don't know why value of startTime change after adding endTime query?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda