If a woman sees menstrual blood one hour before Fajr, then goes to sleep, and sees that her period has ended after that, but she is not sure when it ended – was it before Fajr or after? – then in principle she should assume that her period ended after Fajr.
That is because the principle is that the event should be attributed to the closest time. This is one of the basic principles of jurisprudence (fiqh). What this means is that if there is a difference of opinion regarding the time when something happened and there is no proof to define when it happened, then this event should be attributed to the closest time to the event, because that is what is certain and the more distant time is uncertain."(Mawsu‘ah al-Qawa‘id al-Fiqhiyyah, by Dr. Muhammad Sidqi al-Burno 12/316).
Please see also the answer to question no. 191684 .
Moreover, the condition of the fast being valid is ascertaining that the period had ended before Fajr, so it is not valid to fast when there is uncertainty about that.
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) was asked about a woman who fasted when she was uncertain as to whether her period had ended, then when she woke up she saw that it had indeed ended. Is her fast valid when she was not certain that her period had ended?
He replied:… With regard to the woman mentioned, her fast is not valid and she has to make up that day. That is because the basic principle is that she was still menstruating and her starting to fast when she was not certain that her period had ended means that she started to do an act of worship when she was not certain about one of the conditions of it being valid, and this means that it was not valid."(Majmu‘ Fatawa ash-Shaykh Ibn ‘Uthaymin 19/107).
Based on that, your fast on that day was not valid, and you have to make it up.
If a woman’s period ends during the day, does she have to refrain from eating and drinking and other things that invalidate the fast for the rest of the day, out of respect for the holy month?
There was a difference of opinion among the jurists regarding that, and there are two views.
The view that is more likely to be correct is that of the Malikis and Shafa‘is, which is that it is not obligatory for her to refrain from eating and drinking. This is the view that was favoured by Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) in ash-Sharh al-Mumti‘ (6/344).
It says in al-Mawsu‘ah al-Fiqhiyyah (18/318): There is no difference of opinion among the jurists that if the menstrual blood ceases after Fajr, then it is not valid for the woman to fast that day, and she has to make it up.
In that case, she must refrain from eating and drinking at that time, according to the Hanafis and Hanbalis.
According to the Malikis it is permissible for her to continue doing that which breaks the fast (eating and drinking), and it is not required for her to abstain.
According to the Shafa‘is, she is not obliged to refrain from eating and drinking. End quote.
And Allah knows best.