Make sure lower date is less than upper date in date range function