bug 1137: fixed the function check_date_differnce