Umar bin Khattab came on the day of the Battle of the Trench after the sun had set, cursing the disbelievers of Quraysh, and said, "Messenger of Allah, I could hardly pray until the sun was about to set."The Prophet ﷺ said, "By Allah, I have not prayed it either."So we went down with the Prophet ﷺ to Buthan, where he performed ablution for the prayer and we did the same. He prayed Asr after the sun had set, and then prayed Maghrib after it.
أن عمر بن الخطاب جاء يوم الخندق بعدما غربت الشمس جعل يسب كفار قريش وقال: يا رسول الله ما كدت أن أصلي حتى كادت الشمس أن تغرب. قال النبي ﷺ: والله ما صليتها فنزلنا مع النبي ﷺ بطحان، فتوضأ للصلاة وتوضأنا لها، فصلى العصر بعدما غربت الشمس، ثم صلى بعدها المغرب.
Bukhari narrated it in the Book of Military Expeditions (4112), and Muslim narrated it in the Book of Mosques and Places of Prayer (31:209), both of them through Hisham (he is Ibn Abdullah Dastawai), from Yahya bin Abu Kathir, who said, Abu Salama bin Abdul-Rahman narrated to us, from Jabir bin Abdullah , who said, then he mentioned it.