Abu Huraira reported Messenger of Allah ﷺ as saying: Observe fast on sighting it (the new moon) and break it on sighting it. But if (due to clouds) the actual position of the month is concealed from you, you should then count thirty (days).
وَحَدَّثَنَا عُبَيْدُ اللَّهِ بْنُ مُعَاذٍ، حَدَّثَنَا أَبِي، حَدَّثَنَا شُعْبَةُ، عَنْ مُحَمَّدِ بْنِ زِيَادٍ، قَالَ سَمِعْتُ أَبَا هُرَيْرَةَ، - رضى الله عنه - يَقُولُ قَالَ رَسُولُ اللَّهِ ﷺ
" صُومُوا لِرُؤْيَتِهِ وَأَفْطِرُوا لِرُؤْيَتِهِ فَإِنْ غُمِّيَ عَلَيْكُمُ الشَّهْرُ فَعُدُّوا ثَلاَثِينَ " .