The Messenger of Allah ﷺ said, "When you see the crescent moon, begin fasting, and when you see it again, break your fast. If it is obscured from you, then count thirty days."
قال رسول الله ﷺ: إذا رأيتم الهلال فصوموا، وإذا رأيتموه فأفطروا، فإن أغمي عليكم فعدوا ثلاثين يوما.
Imam Ahmad (14526), Abu Yaala (2248), and Bayhaqi (4/206) all narrated it through Rawh bin Ubada, who said, "Zakariya narrated to us, Abu Zubayr narrated to us, that he heard Jabir bin Abdullah," then he related it. Its isnad is sahih.Imam Ahmad (14670) also narrated it through another route from Ibn Lahia, "Abu Zubayr narrated to us," he said, "I asked Jabir, 'Did you hear the Messenger of Allah ﷺ say, "Do not fast until you see the new moon, and if it is concealed from you, then complete thirty days"?'" Jabir said, "The Messenger of Allah ﷺ stayed away from his wives for a month, then he came down on the twenty-ninth day and said, 'The month can be twenty-nine days.'"