We were sitting with the Prophet ﷺ when he looked at the moon on the night of the full moon and said, "You will surely see your Lord just as you see this moon, without any difficulty in seeing Him. So if you are able to avoid being kept from a prayer before sunrise and a prayer before sunset, then do so."
كنا جلوسا عند النبي ﷺ إذ نظر إلى القمر ليلة البدر قال: أما إنكم سترون ربكم كما ترون هذا القمر، لا تضامون في رؤيته، فإن استطعتم أن لا تغلبوا على صلاة قبل طلوع الشمس، وصلاة قبل غروب الشمس، فافعلوا.
Bukhari narrated it in the Book of Tawheed (7434), and Muslim in the Book of Mosques (633), both through Ismail bin Abu Khalid, who said, Qays bin Abu Hazim narrated to us, saying, I heard Jareer bin Abdullah, and he mentioned it.Muslim added, then Jareer recited, "And glorify your Lord with praise before the rising of the sun and before its setting" [Taha 20:130].There are other hadiths on this subject mentioned in the Book of Faith.