fixed date compare in if statement