added date range checking in search function