added error handling to calculate arrival date function