Anas b. Malik reported that Allah's Messenger (ﷺ) offered the 'Id prayer and then delivered the sermon giving the command:
He who slaughtered the animal before prayer should slaughter (another animal as a sacrifice). The rest of the hadith is the same.