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

93
Views
Calculate the date yesterday in node js?

How can I calculate last day as a date in node jst?

I run the script include data of yesterday. i wanna change it.the last day of month i have issue. for example Date:1-4-2022 but the script include data of yesterday we need the file name is :Example_March

how can i define it in this code

 const curMonth = new Date().toLocaleString("default", { month: "long" });

  let fileName = `example_${curMonth}.xlsx`;
  

  writeInFileAsync(html, fileName).then(() => {
    sendEmail(htmlForEmail, fileName);

)}

and save the sheet its the same issue.

const convertJsonToExcel = (table, fileName) => {
  var wb = XLSX.utils.table_to_book(table, {
    sheet: `example_${new Date().getMonth() + 1}`,
    
  });

  XLSX.writeFile(wb, fileName, { cellStyles: true });
};
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

To calculate the yesterday date in javascript, you can use this helper function:

function getYesterdayDate() {
  return new Date(new Date().getTime() - 24*60*60*1000);
}
about 4 years ago · Santiago Gelvez Report
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!