Hi guys, Can you help me what is the right event in calculating the difference between 2 dates.

what is the right calendar event to trigger my commands.
Code:
    var a =  Ext.getCmp('date_hired').getRawValue();
    var b =  Ext.getCmp('date_separation').getRawValue();
    var day = 1000*60*60*24;
    var month = 30*60*60*24;
    var year = 365*60*60*24;
    
    var x = a.split("/");
    var y = b.split("/");
    
    var date1 = new Date(x[2],(x[1]-1),x[0]);
    var date2 = new Date(y[2],(y[1]-1),y[0]);
    
    var c = Math.ceil((date2.getTime()-date1.getTime()) / (day));
thanks in advance.