(2) بَاب وُجُوبِ صَوْمِ رَمَضَانَ لِرُؤْيَةِ الْهِلَالِ وَالْفِطْرِ لِرُؤْيَةِ الْهِلَالِ وَأَنَّهُ إِذَا غُمَّ فِي أَوَّلِهِ أَوْ آخِرِهِ أُكْمِلَتْ عِدَّةُ الشَّهْرِ ثَلَاثِينَ يَوْمًا
Abu Huraira reported Allah's Messenger (ﷺ) as saying:
Whenever you sight the new moon (of the month of Ramadan) observe fast. and when you sight it (the new moon of Shawwal) break it, and if the sky is cloudy for you, then observe fast for thirty days.
Reference: Sahih Muslim 1081 a
In-book reference: Book 13, Hadith 20
USC-MSA web (English) reference(deprecated numbering scheme): Book 6, Hadith 2378