Conditions of Valid Fasting
Among the conditions for one's fasting to be valid is that the person does not become insane, not even for a moment, during the fasting day. If a person loses his sanity during the day or during part of the day, even for a moment, then his fasting will be invalidated.
In addition to this, one's fasting is invalid if one loses consciousness during the entire fasting day, that is, from the dawn until sunset. However, if one loses consciousness for only part of the day, this does not invalidate the fast.
On the other hand, sleeping does not invalidate the fast, even if one slept all day long
Days of Unlawful Fasting
It is invalid to fast the day of the feast of Fitr (^Id-ul- Fitr), the day of the Feast of Adha (^Id-ul-‘Adha) and the three (Tashriq) days after the day of Adha.
It is also invalid to fast the last half of Sha^ban and the Day of Doubt, except if one joins the fasting of these with those before them or if one is fasting for an expiation (kaffarah), make up (qada'), vow (nadhr), or habitual consistent practice (wird), like the one who usually fasts Mondays and Thursdays.
The day of doubt is the 30th of Sha^ban if the crescent was not sighted the previous night or the people started to mention amongst each other that the crescent was sighted however it was not confirmed if the person(s) who sighted it was or were upright (trustworthy) or not