Symantec IGA

 View Only
  • 1.  Identity Portal forms - dates management

    Posted Jul 17, 2018 11:41 AM

    Hi Experts,

     

    anybody knows how to manage dates in Identity Portal forms? Looks like I cannot use the constructs of RhinoJS, like in BLTH, on the handlers javascript.

     

    I need to compare two dates, activation and expiration date, to be sure that expiration is after.

     

    If I do:

    var actDate = api.getProp("activationDate").value;
    console.log("actDate=" + actDate + " expDate=" + prop.value);

     

    I get:

    actDate=Wed Jul 18 2018 00:00:00 GMT+0300 (Eastern European Summer Time)

    expDate=Fri Jul 20 2018 00:00:00 GMT+0300 (Eastern European Summer Time)

     

    I could write a Java plugin or probably a JS plugin to compare them. Is there a way to do that inside the onchange handler?

     

    Thanks.

    Massimo.



  • 2.  Re: Identity Portal forms - dates management
    Best Answer

    Posted Jul 17, 2018 05:26 PM

    Hi,

     

    You could try this code for your requirement

     

    var actDate = new Date(api.getProp("activationDate").value);

    var expDate = new Date(api.getProp("expirationDate").value);

     

    //Convert date to the numerical value format and compare these values

     

    If ((actDate.getTime()) > (expDate.getTime()))

    {

    prop.errors = ["Expiration Date is before activation date"];

    return false;

    }

    else

    {

    return true;

    }



  • 3.  Re: Identity Portal forms - dates management

    Posted Jul 18, 2018 03:09 AM

    Thanks a lot, this worked (with Date)!