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

160
Visualizações
AWS Lambda difference in days should be 3, getting 19097

I have a AWS lambda function, part of which computes the difference between a previous date and todays date, adjusts to represent as days and then finally rounds this to the nearest number, so 12.8 days for example will be 13.

I'm wondering if anyone knows if Lambda has some different way of representing Date() functions, because upon logging the results of various steps in the process I'm getting some weird values returned and hence my function isn't working. Here's some code:

const today = new Date();
let item = {lasetReceiptCreated: '2022-04-11T20:00:22.549Z'};

let lastReceiptCreated = new Date(item.lasetReceiptCreated);
let dateDiff = today.getTime(); - lastReceiptCreated.getTime();
let diffInDays = Math.round(dateDiff / (1000 * 3600 * 24));

console.log('SkipDayCalc: ','\ndiff: ',diffInDays,'\ntoday.getTime: ',today.getTime(),'\nreceipt.getTime(): ',lastReceiptCreated.getTime());

The resulting log shows this:

SkipDayCalc:  
diff:  19097 
today.getTime:  1649963123100 
receipt.getTime():  1649707222549

So why is my diffInDays value returning as 19097? When I run in a node sandbox I'm getting the correct value with the same exact code.

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