checking the order of the dates