Salam, as with any other namaz there is a time where the namaz becomes qaza. What’s the ruling for maghrib, does it have to read within a certain time from when the azaan went?
The ending time for magrib is different according to the different madhabs.
According to the Hanafis, Hanbalis, one group of the Shafi'is and some of the Malikis: its time ends when twilight disappears (and this twilight is interpreted by the majority of them as the redness in the sky), based on the hadith:
ووقت صلاة المغرب ما لم يغب الشفق
The time for the Maghrib prayer is so long as the twilight has not yet disappeared.
According to the later opinion of Imam Shafi'i and the mashur view of the Malikis: the time for maghrib is fixed and restricted. It ends when a period of time passes after sunset in which a person can become purified and offer the rakahs of maghrib. This is based on the fact that in the hadith of Gabriel, maghrib was offered at the same time on both days.
أمني جبريل عليه السلام ... وصلى بي - يعني المغرب - حين أفطر الصائم ... فلما كان الغد ... صلى بي المغرب حين أفطر الصائم ... والوقت ما بين هذين الوقتين
Gabriel (ﷺ) led me in prayer ... he prayed the sunset prayer with me when one who is fasting breaks the fast ... On the following day ... he prayed the sunset prayer at the time when one who is fasting breaks the fast ... the time is anywhere between two times.
Note that it is agreed upon that it is at least recommended to perform maghrib early, right after sunset.
Bismillahir Rahmanir Rahim. Alhamdulillahi rabbil-'alamin. Was-Salatu was-Salam 'ala Sayyidina wa Azimina, Wa Habibi Qulubina wa Shafii Nufusina, Abul Qasim Muhammad. Wa 'ala Ahli Bayti tayyibina tahireen.
Start of Al-Maghrib
The time for Al-Maghrib is when the redness goes away from eastern half of the sky, after sunset, according to following Hadith narrations.
(It has been narrated) from Abu Abdullah (Imam Jafar As-Sadiq) (asws), said, ‘I heard him (asws) saying: ‘The time for Al-Maghrib is when the redness goes away from the east. And do you know how that is?’ I said, ‘No’. He (asws) said: ‘Because the east overlooks upon the west like this’, and he (asws) raised his (asws) right hand above his (asws) left, ‘So when (the sun) disappears from over here, the redness goes away from over there’.
(It has been narrated) from Abu Abdullah (asws) having said: ‘The time of the falling of the disc (setting of the sun), and Obligation of the breaking of the Fast is that you stand parallel to the Qiblah, and the redness which raised from the east is lost. So when it exceeds the top of the head to the western area, so the breaking of the Fast is Obligated and the disc has fallen (the sun has set)’.
So the moment of sunset is not start of Al-Maghrib time. It takes some time. How long it takes depends on geo-location and season.
End of Al-Maghrib
The end time for Al-Maghrib is when redness (twilight) disappears from the sky completely. And it is important to note that brightness still remains in the west.
‘I asked Abu Abdullah (asws), ‘When is the darkness (Al-Isha Salāt) Obligated?’ He (asws) the twilight disappears, and the twilight is the redness’. So Ubeydullah said objecting, ‘May Allah (azwj) Keep you (asws) well! Intense brightness tends to remain after the departure of the redness’. So Abu Abdullah (asws) said: ‘The twilight, rather it is the redness, and the brightness is not from the twilight’.
State of the sky right after sunset
Time for Al-Maghrib based on descriptions in Hadithes above
According to my own observations, in summer time, in my area, Al-Maghrib time starts approximately 40-45 minutes after sun sets. This is the moment I can see the descriptions given in the Hadith narrations. After that redness is disappearing completely after 30-35 minutes. In different areas, depending on time of the year, Al-Maghrib time may behave differently.