Al-Hafidh An- Nawawee, may Allah shower blessings on him, recorded this hadeeth of Aboo Hurayrah, may Allah be pleased with him, under the chapter on the obligation of Ramadan fast. He narrated that the Prophet ﷺ said: "When Ramadan begins, the gates of Paradise are opened, the gates of the Hell are closed, and the devils are chained." These three things take place in Ramadan.
Firstly, the gates of Paradise are opened in order to arouse those working for it to engage in abundant acts of obedience such as Salat, charity, remembrance of Allah, recitation of the Qur'an and similar acts.
Secondly, the gates of Hell are closed. This is because of the minimal sins recorded therein from the believers.
Thirdly, the devils are chained; that is, al- Mardah among them as reported in another version. Al-Mardah refers to the worst of devils in enmity and attack on the children of Adam. "and the devils are chained" implies their hands will be shackled, so they will not be able to do what they used to do in other months.
Each of what the Prophet ﷺ has informed us is the truth. He said this as a form of counsel to the Ummah, urging it to perform good deeds and warning it from evil.
As for the second hadeeth of Aboo Hurayrah, the Prophet ﷺ said, "Observe fast on sighting the crescent and terminate it on sighting it (the new moon)." That is, it is obligatory for the Muslims to commence
fast once they sight the crescent of Ramadan; fasting does not become compulsory except they see it.
Accordingly, he ﷺ said, "But if the sky is cloudy before you, complete the calculation of thirty days of (the month of) Sha'ban." That is, if the clouds obscure the crescent, it becomes obligatory to complete Sha'ban as thirty days before they commence fasting. This is the version of Al-Bukhari.
In the version of Muslim: "Observe fast for thirty days." This is if the crescent of Shawwal is hidden. In this hadeeth, the Prophet ﷺ explained that if the crescent is hidden on the thirtieth night of Sha'ban, it is obligatory to complete the counting of Sha'ban as thirty. Similarly, if the crescent is concealed on the thirtieth night of Ramadan, it should be completed as thirty days.
Allah alone grants success.