Issue 4: Updated to return the redirect loop in the checkDate function