Praise be to Allah.
If a person intends to fast on Mondays and Thursdays, or any other days, with an uncertain intention (niyyah) – that if he owes any days then it is to make up for them, and if he does not owe any days, then it is a naafil fast – that is akin to one who intends to fast Ramadan with an uncertain intention, that if tomorrow is Ramadan, then it is my obligatory fast. What is more likely to be the case is that his fast is valid.
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said:
An uncertain intention is valid, such as if a person says: If tomorrow is Ramadan, then it is my obligatory fast, otherwise it is a naafil fast. This is one of the two views narrated from Ahmad.
End quote from al-Ikhtiyaaraat (p. 95).
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
If a person intends that if tomorrow is Ramadan, then it is my obligatory fast, that is not valid.
This is an important scenario that happens often. It is not acceptable for a person to intend that if tomorrow is Ramadan, it will be the obligatory fast, regardless of whether he say after that, Otherwise it will be a naafil fast, or he says: Otherwise, I will not fast.
An example of that is a man who sleeps early on the night before the thirtieth of Sha‘baan, when there is the possibility that this may be the first night of Ramadan, so he says: If tomorrow is Ramadan, then it is my obligatory fast, or he says: If tomorrow is Ramadan, then I will fast, or, If tomorrow is Ramadan, then it is the obligatory fast, otherwise it will be for an obligatory expiation, and other such conditional scenarios.
The correct view is that his fast is not valid in this case, because when he said: If it is such and such, then it is the obligatory fast, this shows uncertainty, and the intention (niyyah) must be based on certainty. For example, if he does not wake up until after dawn has broken, then he realizes that it is (the first day of) Ramadan, then he must make up that day, according to our view.
The second report from Imam Ahmad is that the fast is valid if he realizes that it is Ramadan (when he wakes up). This was the view favoured by Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him).
Perhaps that is included in the general meaning of the words of the Prophet (blessings and peace of Allah be upon him) to Dubaa‘ah bint az-Zubayr (may Allah be pleased with her): “You have the right before your Lord to avail yourself of the condition that you stipulated.” This man stipulated this condition because he did not know whether the following day would be Ramadan, so his uncertainty had to do with the beginning of the month; there was no uncertainty about his intention and whether he would fast or not.
Hence, if one for whom it is permissible not to fast were to say on the first night of Ramadan: Maybe I will fast tomorrow and maybe I will not fast, then he decides to fast after dawn has broken, his fast is not valid, because he was uncertain in his intention.
But if he made his fasting conditional upon it being proven that the month has begun, then this is a real-life situation, so if it is not proven that the month has begun, he will not fast.
Based on that, if we sleep before news comes on the night before the thirtieth of Sha‘baan, we should intend in our minds that if tomorrow is Ramadan, then we will fast. Even though this is the intention of every Muslim in general terms, that he will fast if it is Ramadan, having a specific intention is better. So he should say to himself: If tomorrow is Ramadan, then it will be my obligatory fast. Then if he finds out that it is Ramadan after dawn has broken, his fast will be valid.
But if he says on the night before the thirtieth of Ramadan: If tomorrow is Ramadan that I am fasting, otherwise I am not fasting, the scholars said that this is permissible, even though there is some uncertainty in his intention, because the intention is based on whether it is proven that the new month has begun.
As that is the case, the uncertainty should be the same at the beginning of the month as at the end of it. But they are different in that at the beginning of the month the basic principle is that there is no fasting, because the beginning of the month has not yet been proven, and at the end of the month it is the other way round: the basic principle is that one is fasting, because the next day is part of Ramadan, unless it is proven that the month has ended.
But this differentiation should not affect the fact that there is an uncertain intention in both cases. Both intentions are uncertain, and both possibilities are there in both cases. There is uncertainty about the thirtieth day of Sha‘baan: Will it turn out to be the first day of Ramadan or not? And there is uncertainty about the thirtieth day of Ramadan: will it turn out to be [the last day of] Ramadan or not?
End quote from ash-Sharh al-Mumti‘ (6/361-363).
Shaykh Ibn ‘Uthaymeen also said, regarding one who is not sure about the number of days of Ramadan he has to make up: To be on the safe side, he should make up the day of which he was uncertain, because if it was obligatory for him, he will have done what is required of him for certain, and if it was not obligatory, then it will be a voluntary fast. Allah, may He be exalted, will not cause to be lost the reward of one who does good.
End quote from Fataawa Noor ‘ala ad-Darb.
See also question no. 118281.
If a woman is not sure whether a fast is obligatory or not in her case, then she intends to fast with an uncertain intention: if she owes any fasts, then this will be making up a fast, and if she does not owe any fasts, then her fast will be naafil. In that case her fast will be valid and will make up the missed fast, if she owed any fasts for days that she missed in Ramadan.
However, what she should do is not make this the case in all of her fasts. Rather she should try to work out the number of days that she fears she must make up from the past, and try hard to absolve herself, thenmake a certain intention for her fast: either to make up for a missed fast or to observe a naafil fast. … She should not open the door to intrusive thoughts (waswasah) and doubts and uncertainty about her acts of worship.
And Allah knows best.