Instead of waiting for the exception here, could we instead extract this into a new method `get_end_date()` which takes care of this logic using the if/else below.