Bulugh al-Maram 652
وَعَنِ ابْنِ عُمَرَ رَضِيَ اللَّهُ عَنْهُمَا قَالَ: سَمِعْتُ رَسُولَ اللَّهِ - صلى الله عليه وسلم - يَقُولُ: «إِذَا رَأَيْتُمُوهُ فَصُومُوا, وَإِذَا رَأَيْتُمُوهُ فَأَفْطِرُوا, فَإِنْ غُمَّ عَلَيْكُمْ فَاقْدُرُوا لَهُ». مُتَّفَقٌ عَلَيْهِ. وَلِمُسْلِمٍ: «فَإِنْ أُغْمِيَ عَلَيْكُمْ فَاقْدُرُوا لَهُ ثَلَاثِينَ». وَلِلْبُخَارِيِّ: «فَأَكْمِلُوا الْعِدَّةَ ثَلَاثِينَ».
From Ibn ʿUmar, may Allah be pleased with them both, who said: I heard the Messenger of Allah ﷺ say: "When you see it, fast, and when you see it, break the fast; and if it is clouded over for you, then estimate for it." Agreed upon. Muslim has: "If it is clouded over for you, then estimate thirty for it." Al-Bukhari has: "Then complete the count of thirty."