Giving these alms is mandatory after sunset on the eve of Eidul - Fitr. If a Muslim expires seconds before sunset, it is not mandatory for his next of kin to give on his behalf. But if he expires seconds after sunset, alms should be given on his behalf. So is the case of the newly born.
As for the time it should be given, there are two time periods: The best and optional times. The best time is the morning of Eidul - Fitr before prayer. In a Hadith related by Ibn Umar (May Allah be pleased with him), the Messenger of Allah (p.b.u.h.) commanded the Muslims to give alms when fast breaking people leave for Eid prayer." (Muslim and others)
In his commentary on the following verse, Ibn Uyainah said: "But those will prosper who purify them (give alms) and glorify the name of their guardian Lord and pray."
He said: the word "tazakka", purify or giving alms, comes before the word "Salla", prayer. This is why it is better to delay `Eidul-Fitr prayer so that the believers will have enough time to give their alms.
The optional time to give alms is one or two days before Eid, that is on the 28th and 29th day of Ramadan. Legally, you have these three days to give your alms. But it should not be delayed past Eid prayer. In that case, Zakatul-Fitr is not valid unless there is a reason, as mentioned earlier in the Hadith of Ibn Abbas (May Allah be pleased with him).
But if there is a compelling reason, such as Eid occurring in a place where there is no food to be purchased, or the food is bought, but there is no one to receive it, or the news about Eid comes late in the morning and one does not have enough time to buy the alms, or he depends on someone to give his Zakat on his behalf, and the person forgets In these instances, the alms can be given after `Eid because of the valid excuse.
The alms should reach its recipients before Eid prayer, not after. The beneficiaries should physically have it in their possession. If you intend to give alms to someone and he cannot be found, it should be given to someone else, so that you do not miss the time.