Fix for broken date comparison.

Special thanks to Daniel B. for catching this one :)