The Messenger of Allah ﷺ said, "When you see the crescent moon, begin fasting, and when you see it again, end your fast. If it is hidden from you by clouds, then complete thirty days of fasting."
حدثنا عبد الأعلى عن معمر عن الزهري عن أبي سلمة بن عبد الرحمن
أن رسول الله ﷺ قال إذا رأيتم الهلال فصوموا وإذا رأيتموه فأفطروا فإن غم عليكم فصوموا ثلاثين يوما
Its chain of transmission is sahih. Muslim (1:299), Nasai (1:301), Ibn Majah (1655), and Bayhaqi (4:204) all narrated it, all from Zuhri, from Saeed bin Musayab, from Abu Hurairah, with the same wording.Muslim, Nasai, and Bayhaqi also narrated something similar from the hadith of Abu Zinad, from Aaraj, from Abu Hurairah. In their versions, the ending reads, "then count thirty."Shafii (1:274–275) narrated in his Musnad, arranged by Shaykh Abid Sindi, and Tirmidhi (2:32) narrated something similar in meaning through the route of Muhammad bin Amr, from Abu Salama, from Abu Hurairah, as part of a marfu hadith, "Fast upon sighting it, and break the fast upon sighting it, and if it is obscured from you, then count thirty." Tirmidhi added, "then break your fast," and said, "The hadith of Abu Hurairah is hasan sahih."Bukhari (4:106) narrated through the route of Shuba, from Muhammad bin Ziyad, from Abu Hurairah, something similar with the wording, "then complete the count of Shaban as thirty." Muslim, Nasai, and others also narrated it through this route, but with an unqualified mention of completing the count, without specifying Shaban or fasting.In my view, all of this carries one and the same meaning, that Shaban or Ramadan should be completed as thirty days if the crescent of the month that follows is obscured from them.See also 1985, 2335, 6323.