(19) باب النَّهْىِ أَنْ يُخْرِجَ فِي الصَّدَقَةِ شَرَّ مَالِهِ
It was narrated that:
Bara bin Azib said concerning the Verse: "And of that which We have priduced from the earth for you, and don not aim at that which is bad to spend from it. " [Al-Baqarah 2:267] "This was revealed concerning the Ansar. At the time of the new date-palm harvest, they would take a bunch of dates that were beginning to ripen and hang it on a rope between two of the pillars in the mosque of the Messenger of Allah (ﷺ), and the poor emigrants would eat from it." One of them deliberately mixed a bunch containing rotten and shriveled dates, and thought this was permissible because of the large number of dates that had been put there. So the following was revealed about the one who did that: '… and do not aim at that which is bad to spend from it'. Meaning do not seek out the rotten and shriveled dates to give in charity: '…(thought) you would not accept it save if you close your eyes and tolerate therein.' Meaning, if you were given this as a gift you would only accept it because you felt embarrassed, and you would get angry that he had sent something of which you have no need. And know that Allah has no need of your charity."
Reference: Sunan Ibn Majah 1822
In-book reference: Book 8, Hadith 40
English translation: Vol. 3, Book 8, Hadith 1822