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

115
Vistas
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 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