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

277
Visualizações
Datepicker calendar a previous and next date button

I am working on a datepicker calendar for adding a previous and next date feature, a button on click. I tried in PHP and JS and I did not have success on both.

window.onload = function () {
      let today = new Date();
      let D = String(today.getDate()).padStart(2, '0');
      let M = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
      let YYYY = today.getFullYear();
      today = YYYY + '-' + M + '-' + D; 
      let today2 = new Date();
      today2 = M + "/" + D + "/" + YYYY;
      
      var prevday = new Date();
          prevday.setDate(prevday.getDate() - 1);

          var nextday = new Date();
          nextday.setDate(nextday.getDate() + 1)

addRow('<tr><td colspan="2"><h3>Eventsz for <a href="#" id="datepick1" class="fa fa-chevron-left lg" title="Previous Date"></a>'+ '&nbsp;&nbsp;&nbsp;&nbsp; '  + today2 + '&nbsp;&nbsp;&nbsp;&nbsp; ' + '<a href="#" id="prev" class="fa fa-chevron-right lg" title="Next Date"></h3></td></tr>');

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Don't know if its a typo but in your snippet you are missing a trailing }.

window.onload = function () {
      let today = new Date();
      let D = String(today.getDate()).padStart(2, '0');
      let M = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
      let YYYY = today.getFullYear();
      today = YYYY + '-' + M + '-' + D; 
      let today2 = new Date();
      today2 = M + "/" + D + "/" + YYYY;
      
      var prevday = new Date();
          prevday.setDate(prevday.getDate() - 1);

          var nextday = new Date();
          nextday.setDate(nextday.getDate() + 1)
} // Missing

// addRow('<tr><td colspan="2"><h3>Eventsz for <a href="#" id="datepick1" class="fa fa-chevron-left lg" title="Previous Date"></a>'+ '&nbsp;&nbsp;&nbsp;&nbsp; '  + today2 + '&nbsp;&nbsp;&nbsp;&nbsp; ' + '<a href="#" id="prev" class="fa fa-chevron-right lg" title="Next Date"></h3></td></tr>');

about 4 years ago · Juan Pablo Isaza 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