Setting minutes at the time of operation

0

I have the following code, where it determines the time of delivery. Here is the code:

function delivery(){
  var cep1 = document.getElementById("cep1").value;
  var cep2 = document.getElementById("cep2").value;
  var cep = cep1 + "-" + cep2;
  var data = new Date();
  var mes = data.getMonth() + 1; 
  var diaMes = data.getDate();
  var hoje = diaMes + "/" + mes;
  var diaSemana = data.getDay();
  var hora = data.getHours();           // 0-23
  if(feriados.indexOf(hoje) != -1 || diaSemana == 0 || diaSemana == 6){
      $("#data").venobox().trigger('click');
  }else if(hora < 7 || hora > 16){
      $("#hora").venobox().trigger('click');
  }else if(ceps.indexOf(cep) == -1){
      $("#cep").venobox().trigger('click');
  }else{
      if (diaSemana == 1){
          location.assign("http://bardananatural.com.br/pedido_online/segunda/index_segunda.php");
      } else if (diaSemana == 2){
          location.assign("http://bardananatural.com.br/pedido_online/terca/index_terca.php");
      } else if (diaSemana == 3){
          location.assign("http://bardananatural.com.br/pedido_online/quarta/index_quat.php");
      } else if (diaSemana == 4){
          location.assign("http://bardananatural.com.br/pedido_online/quinta/index_quin.php");
      } else if (diaSemana == 5){
          location.assign("http://bardananatural.com.br/pedido_online/sexta/index_sext.php");
      } else {
          $("#hora").venobox().trigger('click');
      };
  };
 }

What I do not know how to do and I need to put the time limit from 4pm (today) to 3:30 PM, ie put the minutes that do not exist today. I know the code snippet is this:

var hora = data.getHours();         // 0-23
  if(feriados.indexOf(hoje) != -1 || diaSemana == 0 || diaSemana == 6){
      $("#data").venobox().trigger('click');
  }else if(hora < 7 || hora > 16){
      $("#hora").venobox().trigger('click');

I just do not know how! Thank you all for your help!

    
asked by anonymous 29.09.2017 / 20:01

1 answer

0

I think you can resolve this quietly with the moment.js library:

Example:

moment().format('MM DD YYYY, h:mm:ss'); // 09 29 2017, 3:07:08
    
29.09.2017 / 20:08