The Prophet ﷺ made the Zakat al-Fitr obligatory, and they used to give it a day or two before Eid al-Fitr.
فرض النبي ﷺ صدقة الفطر…، وكانوا يعطون قبل الفطر بيوم أو يومين.
Bukhari narrated it in the Book of Zakat (1511) from Abu Numan, who said, Hammad bin Zayd narrated to us, who said, Ayub narrated to us, from Nafi, from Ibn Umar, and he related it.The time for paying out Zakat al-FitrThe time of excellence, it begins at the break of dawn on the day of Eid and continues until shortly before the Eid prayer is performed, based on the hadith of Abdullah bin Umar.The time of performance, it begins one or two days before Eid, following the practice of some of the companions, among them Ibn Umar.The time of making it up, it begins after the Eid prayer, based on his saying ﷺ, "Whoever pays it before the prayer, it is an accepted zakat, and whoever pays it after the prayer, it is charity like any other charity," as will be mentioned later.This means that the obligation does not lapse once the time of excellence and the time of performance have passed, for it must still be made up afterward.