correcting date comparison