Fixing ordering of date logic.