It is authentically reported in Ṣaḥīḥ Muslim, on the authority of ʿAbd Allāh ibn ʿAmr ibn al-ʿĀṣ, that the Prophet—peace and blessings be upon him—said: “The time for ʿIshāʾ lasts until midnight.” No sound narration from the Messenger of Allah ever states that the period for ʿIshāʾ extends until daybreak. Hence the more correct view is that it ends at midnight, and the noble verse points to this as well. Allah says, “Establish prayer at the sun’s decline” — that is, when it passes the meridian — “until the darkness of night” (Q 17:78). He mentioned these three prayers together because no gap separates them: the moment Dhuhr ends, ʿAsr begins; as soon as ʿAsr ends, Maghrib begins; and immediately after Maghrib ends, ʿIshāʾ begins. As for Fajr, Allah says, “and the dawn recitation; indeed, the dawn recitation is witnessed” (Q 17:78). Fajr is not contiguous with any other prayer, for between it and Dhuhr lies the first half of the day, and between it and ʿIshāʾ lies the second half of the night.
Be aware that a prayer performed before its prescribed time is not accepted, even if the worshipper utters the opening takbīr and the time then enters a moment later. It will not count as an obligation, for anything bound to a fixed time is invalid before that time—just as fasting a day before Ramaḍān does not count for Ramaḍān. Likewise, if one pronounces the opening takbīr before the time begins, the prayer is not accepted as a farḍ act. If, however, he was genuinely unaware, the prayer is treated as voluntary and he must repeat the obligatory one.