date comparing correctly