Fixed sorting of DateTimes

Appears to be a pretty old regression.  Added a unit test for this.