Fixes #871.

Added a comparator for DateTime objects.
Cleanup
Fix test