I was trying to use getTime() function to calculate the date difference. As per my understanding, the latest date would return higher getTime() value c
getTime()