In the new movie "Don't Look Up", astronomers discover a comet in the outer Solar System that's going to hit the Earth about 7.5 months later. I think they calculate its trajectory within a day of discovering it, and they're virtually certain that it will impact the Earth, knowing the exact day and time.
While I believe that they can determine when it will pass by with that accuracy, I wonder if they can tell that early how close it will come. In the past astronomers have found asteroids that would come near Earth, and early reporting didn't seem to be so precise about the distance.
The comet was described as an Oort Cloud object, and I think it was its first appearance (they named it after the grad student who found it). I'm not sure how far out it was when they discovered it, but at one point in the movie they showed it passing by a gas giant for effect; it might have been Jupiter, but I'm not sure, and I don't recall how long this was after it was first seen.
How long would they need to observe such an object, and roughly how close would it have to be before they can determine the tractory precisely enough to know that it will hit Earth? How much advance warning would we have of certain cataclysm?