“Asalam u alaikum, i wanted to ask about when exactly does the timing of maghrib end according to the hanafi fiqh, and the shafii fiqh?”
All praise be to Allah, and may His blessings and peace be on His final messenger,
The time of the Maghrib prayer begins at sunset by consensus. Its end is controversial. The Hanafis and Hanbalis held that it ends at the disappearance of the twilight, which is the beginning of the ‘Isha time. Their proof is the saying of the Messenger of Allah:
“… وَوَقْتُ صَلاَةِ الْمَغْرِبِ مَا لَمْ يَغِبِ الشَّفَقُ”
“… And the time of the evening prayer is as long as the twilight has not ended.”
[Sahih Muslim: Book 5, Hadith 222]
The Malikis and Shafi’is held that the time of Maghrib ends upon the passage of enough time from sunset for one to perform the prerequisites of the prayer and pray (three rak’aat, according to the Malikis, and five, according to the Shafi’is). Their proof is the hadeeth that relates that Jibreel led the Prophet on two successive days, at the beginning of the obligation of the five daily prayers; on the first day, they prayed at the beginning of the time, and on the second day, at the end of the time. On both days, they prayed Maghrib right after sunset. [Sunan Abi Dawud – English translation: Book 2, Hadith 394]
The position of the Hanafis and Hanbalis seems stronger to me, because of the explicit statement of the Prophet in the hadeeth of Muslim, making his prayer with Jibreel at the beginning of the time on both days indicative of the preference of praying it early.