Check that the LC end date found is later than the document date itself

Get all the dates in the SOTD and the first one later than the document date is taken as the LC end date