Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

94
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda