Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

112
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!