CA Service Management

  • 1.  Comparing dates on htmpl form

    Posted Jun 13, 2018 03:23 PM

    Hello, it's possible to compare dates like warranty_end and system date on a PDM_IF?

    I need to evaluate a CI when the user open the CI and set an alert or label to "On Warranty" or "Out of Warranty"

     

    ex.

    <PDM_IF ($args.warranty_end) > (system_date)>

    alert("Out of Warranty");

    </PDM_IF>

     

    Best regards,

    Fabian



  • 2.  Re: Comparing dates on htmpl form

    Posted Jun 14, 2018 03:12 AM

    Hi Fabian,

     

    I think it would be best to use a JavaScript or Spel-code for this.

     

    ===

    Kind Regards,

    Brian



  • 3.  Re: Comparing dates on htmpl form

    Posted Jun 14, 2018 05:30 AM

    Hi Fabian.

    As Brian already mentioned, you might need to use javascript.

    I'm not aware that you have something like "system_time" avaliable in a pdm_if context

    and you should use $args.date_attribute_INT_DATE  

    so, something like

    if("$args.warranty_end_INT_DATE" != "" && $args.warranty_end_INT_DATE < (new Date).getTime()/1000 ) {

       alert("Out of Warranty");
    }

    might work. 

    Be aware that ...INT_DATE will return epoch time stamp in seconds (UTC) while (new Date).getTime return epoch milliseconds in local browser time!

    Regards

    ............Michael