Eating something thinking that sun has set while it didn’t.
- When I was fasting, I thought the fast had broken and so started to eat a date. However, I then realised that the fast had not broken and there was still approximately 5mins left till maghrib. So I spat out the date without swallowing it. Is my fast still valid?
- What if I swallowed some saliva which was in contact with the date?
In the Name of Allah, the Most Gracious, the Most Merciful.
In principle, if a person consciously eats to break the fast whilst certain that the sun has set, whereas in reality the sun had not yet set, the fast will be invalidated. The fasting person will have to keep a compensatory fast (Qadhā’), however a kaffarah will not be necessary. If the fasting person was not sure that the sun had set and still ate the food merely thinking that the sun has set, he will need to make Qadhā’ as well as kaffarah. 
In your case, however, you did not eat, rather spat the date out. Hence,
- The fast is valid.
- Since you spat out the date to secure your fast, the swallowing of the remaining saliva will not invalidate your fast.
And Allah Ta’ala Knows Best
Mufti Faisal bin Abdul Hameed,
Checked and Concurred by,
Mufti Luqman Hansrot
“أو أفطر يظن الغروب” أي غلبة الظن لا مجرد الشك لأن الأصل بقا النهار فلا يكفي الشك لإسقاط الكفارة على إحدى الروايتين (مراقي الفلاح شرح نور الإيضاح (ص: 675))