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

114
Visualizações
Compare input date with epoch time jQuery/JavaScript

I have snippet I wrote up, though I am a beginner at jQuery & JavaScript so I have no idea what is wrong with the piece of code. I did substantial Googling & StackOverflow searching, to no avail.

I am attempting to retrieve the date from a date field that a user has input (field is: #input_1_12), and compare it with other date times that have been passed as epoch times. When I run the form, the field I want to populate with the code (id: #input_1_111) stays empty.

p.s. I am implementing this in a WordPress site, so I used "jQuery" instead of "$" in the if statement to make sure there's no compatibility issues. Any help would be greatly appreciated!

var saveDate =  new Date($('#input_1_12').val());
var firstQdate = new Date(1554076800);
var secondQdate = new Date(1561939200);
var q1of19 = $('#input_1_22').val();
var q1of20 = $('#input_1_26').val();
var q2of19 = $('#input_1_23').val();
var result;

if ( saveDate < firstQdate ) {
 result = q1of19 / q1of20 ;
jQuery('#input_1_111').val(result).trigger('change');
}
else if ((saveDate > firstQdate) && (saveDate < secondQdate)) {
 result = q2of19 / q1of20 ;
jQuery('#input_1_111').val(result).trigger('change');
}
about 4 years ago · Juan Pablo Isaza
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