refactor date comparison in list comprehension for the case where no start and/or end date are provided