issue with on submit script

hemanth40
Tera Contributor

below code is working UAT but not in PROD. anything is wrong

 

function onSubmit() {
    var hiredate = g_form.getValue('hire_date');
    var rehiredate = g_form.getValue('rehire_date');
    var augdate = '2024-01-01';
    if (hiredate > augdate || rehiredate > augdate) {} else {

        g_form.addErrorMessage("Users are eligible after June 2024");
        return false;
    }
}
3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

It could be something to do with date time format.

 

-Anurag

ok but anything wrong in the script, or let me know any other way can do this validation 

I would use something like this to compare dates

Comparing Client Dates - ServiceNow Community

-Anurag