I sometimes take a sledgehammer approach to these things... specially with dates since formats can drive you crazy. So, I figure out the format the input is, then change it to what I need in code. You only need to get minutes back so you don't really need to reformat a full date back out again. You're passing dates into your function but I'm just testing here directly on a grid... other than the dates coming in, the JS should be the same for you.
Code:
var newDate1 = {grid.Object}.getValue('G','APPTDATE',{Grid.RowNumber});
var newDate2 = {grid.Object}.getValue('G','APPTDATE2',{Grid.RowNumber});
var date1 = new Date(newDate1.slice(3,5) + '/' + newDate1.slice(0,2) + '/' + newDate1.slice(6,10));
var date2 = new Date(newDate2.slice(3,5) + '/' + newDate2.slice(0,2) + '/' + newDate2.slice(6,10));
var yr1 = date1.getFullYear();
var mth1 = date1.getMonth();
var day1 = date1.getDate();
var yr2 = date2.getFullYear();
var mth2 = date2.getMonth();
var day2 = date2.getDate();
var t1 = new Date(yr1, mth1, day1, 0, 0, 0, 0);
var t2 = new Date(yr2, mth2, day2, 0, 0, 0, 0);
var dif = t1.getTime() - t2.getTime();
var Minutes_from_T1_to_T2 = dif / 1000 / 60;
var Minutes_Between_Dates = Math.abs(Minutes_from_T1_to_T2);
alert(Minutes_Between_Dates);
Bookmarks