Reversed comparison for finding the range of dates.  Fixed.