On principle, an incident should be thought of as having happened at the closest time, and this applies to one who did ghusl, then noticed something on his body that prevented water from reaching the skin
Question

I want to ask about the principle which says that an incident should be thought of as having happened at the closest time; what does it mean? Are there conditions attached to it, such as thinking that it most likely happened before that, and so on? Because I have read about it but I did not understand. For example, if someone does ghusl or wudoo’, then finds something that prevented water from reaching his body, such as dough and the like, and he does not know when it got on his skin and whether that was before or after he did ghusl, does he have to repeat ghusl, and does that also apply to wudu’ and other acts of worship? What is meant by the closest time? My second question is: if a woman is uncertain as to whether what is coming out of her is ordinary discharge or madhiy or something else, is it permissible for her to choose between them and follow the ruling that applies to what she chose?
Praise be to Allah.Firstly:
Regarding the principle that “an incident should be thought of as having happened at the closest time”
What this means is that if there is some confusion about when something happened, and there is no evidence to prove when it happened, then this incident should be deemed to have happened at the closest time to its discovery, because there is more certainty in that case, and suggesting a more distant (earlier) time is more doubtful. But if it is proven that it happened at the earlier time, then we should act on that basis."(Mawsu‘at al-Qawa‘id al-Fiqhiyyah by Dr. Muhammad Sidqi al-Burno  12/316).
This meaning may be expressed by the phrase “in principle every incident is to be deemed to have happened at the closest time” or “an incident should be deemed to have happened at the closest time.”
As-Suyuti (may Allah have mercy on him) said in his book al-Ashbah wa’n-Naza’ir (p. 59):
In principle, every incident is to be deemed to have happened at the closest time.
For example, a man saw maniy (semen) on his garment, but he did not remember having a wet dream; in that case he must do ghusl, according to the correct view. He [ash-Shafa ‘i] said in al-Umm: And he must repeat every prayer he offered from the last time he woke up from sleep. End quote.
Another example is someone who did ghusl or wudu’, then he noticed something that prevents water from reaching the skin, such as dough and the like, but he does not know when that got onto his body. In principle, he should assume that it happened after he purified himself, so he does not have to repeat ghusl or wudu’, because an incident should be thought of as having happened at the closest time.
See: Ghamz ‘Uyun al-Basa’ir fi Sharh al-Ashbah wa’n-Naza’ir (1/217); Durar al-Hukkam fi Sharh Majallat al-Ahkam (1/28).
But if there is evidence to indicate that the incident took place at an earlier time, then one should act accordingly.
For example, if the purchaser found a defect in his purchase after he took possession of it, and the seller claims that it happened after the purchaser bought it, whilst the purchaser claims that it happened when it was in the seller’s possession, and neither of them has any proof, then the correct view is the view of the one who claimed that it happened at the closer time – namely the seller in this case – but he must swear an oath, and the defect is regarded as something that happened when the item was in the possession of the purchaser, after he took it away, unless the defect has to do with the way in which the product was made and could not have happened after the purchaser took it away.
See: Mawsu‘at al-Qawa’id (1/113).
Secondly:
Emission of discharge is something normal in women, and is more common than emission of madhiy.
Vaginal discharges are pure (tahir), but they invalidate wudu’, unlike madhiy, which is najis.
We have previously discussed the difference between discharge, madhiy and maniy in the answer to question no. 257369, in which we explained that if someone is not sure about these things, he may choose between them and apply the ruling on one of them. This is the view of the Shafa‘is, and it is easier for the one who suffers from waswasah (intrusive thoughts; whispers from the Shaytan).
It says in Mughni al-Muhtaj (1/215): If it is possible that the discharge may be maniy or something else, such as wadiy or madhiy, then a person may choose between them, according to the correct view.
So if he decides to regard it as maniy, he must do ghusl.
If he decides to regard it as something else, he must do wudu’ and wash off whatever got onto him, , because if he does what is required after deciding what it is, then he will definitely have absolved himself, and the basic principle is that he does not have to worry about the other, and there is no contradictory view. End quote.
And Allah knows best.