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

95
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
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