hammered out a method for comparing dates