Once during the lifetime of Messenger of Allah ﷺ we offered some animals as sacrifices. Some people slaughtered their sacrifices before the (Id) prayer, so when the Prophet ﷺ finished his prayer, he saw that they had slaughtered their sacrifices before the prayer. He said, "Whoever has slaughtered (his sacrifice) before the prayer, should slaughter (another sacrifice) in lieu of it; and whoever has not yet slaughtered it till we have prayed; should slaughter (it) by mentioning Allah's Name." (Using translation from Bukhārī 5500)
ضَحَّيْنَا مَعَ رَسُولِ اللهِ ﷺ أَضْحَى ذَاتَ يَوْمٍ فَإِذَا النَّاسُ قَدْ ذَبَحُوا ضَحَايَاهُمْ قَبْلَ الصَّلَاةِ فَلَمَّا انْصَرَفَ رَآهُمُ النَّبِيُّ ﷺ أَنَّهُمْ ذَبَحُوا قَبْلَ الصَّلَاةِ قَالَ «مَنْ ذَبَحَ قَبْلَ الصَّلَاةِ فَلْيَذْبَحْ مَكَانَهَا أُخْرَى وَمَنْ كَانَ لَمْ يَذْبَحْ حَتَّى صَلَّيْنَا فَلْيَذْبَحْ عَلَى اسْمِ اللهِ»