Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

161
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!