The beginning and ending of the Ramadan is based on the moon

BUKHARI 1909: from Abū Hurayrah —

that the Prophet ﷺ said or he said Abū al-Qasim said, "˹Start˺ fasting ˹the month˺ upon seeing it (the moon), and break ˹fasting the month˺ upon seeing it. If it is hidden for you (as a result of an overcast at the start of the month), then complete thirty days of Shaʿbān."

البخاري ١٩٠٩: عن ابو هريره —

قَالَ النَّبِيُّ ﷺ أَوْ قَالَ قَالَ أَبُو الْقَاسِمِ ﷺ «صُومُوا لِرُؤْيَتِهِ وَأَفْطِرُوا لِرُؤْيَتِهِ فَإِنْ غُبِّيَ عَلَيْكُمْ فَأَكْمِلُوا عِدَّةَ شَعْبَانَ ثَلاَثِينَ۔»


Agreed Upon (Luʿluʿ wa-al-Marjān)
Bukhārī > Fasting > § "Start observing Saum on seeing the crescent of Ramadan,...
hadithunlocked.com