None of the scholars have made it obligatory to check the date before eating it- so that the one who does not check is sinning. However, some of the scholars detested eating dates before checking them, while some have said it is allowed to check the date before eating without making it obligatory and desirable.
The root of this matter is what Abu Dawoud and other authors reported on the authority of Anas bin Malik, who said “When the Prophet (ﷺ) was brought some old dates, he began to examine them and remove the worms from them.” authenticated by sheikh al Albany.
The writer of Awn Al Mabood said in his explanation of this hadith: It is disliked to eat what you think has worms in it, without inspection, he said in Fath al-Wadud, and food does not become impure by finding worms in it, neither does it become forbidden to eat it.
Al Qari said: Al Tabarani narrated with a good chain, on the authority of Ibn Umar who attributed to the Prophet that: “ he forbade checking the dates to know what is in it”. This prohibition is applicable on new dates in order to ward off the doubt or the prophet did this to show that it is permissible, and that the prohibition here is not firmly emphasized.
This hadith that Al Qari said to be sound, was classified to be weak by Sheikh Al Albani, and described it as a denounced narration. (Hadith number 5228 As-silsilah ad-da’eefah)
This is regarding checking the date, as for eating a date that has worms, the Hanafi school of thought forbade eating cheese, or vinegar, or plants that have worms living within them. Other scholars allowed eating them with some conditions. Thus, what should determine this ruling is the filth and harm.
It is mentioned in the Kuwaiti Encyclopedia of Jurisprudence:
The hanafis have said, the worms of bees and other, before the soul has been blown into them is permissible to eat, because they are not dead, and if the soul is blown into them then it is not permissible to eat.
Based on this, it is not permissible to eat cheese, vinegar or fruits with their worms.
The Malikis on the other hand, said: If the worm or any insect dies in the food and can be separated from food, then it has to be removed, and the food can be taken after removing the worms. The food should not be thrown away after taking it out because the dead insect is pure.
However, if the worm has mixed with food in a way that can not be separated, and has spoilt, then the food should be disposed, because the dead worms in it are not permissible even if they are pure. The food can be given to a dog, cat or an animal. Though, if the worms that are not distinguished are few and have not died in the food, it is permissible to eat the food.
All these rulings are applicable only to the worm that does not develop inside the food, be it fruit, or grains or dates. If the worms develop and live in food, it is permissible to eat them with food, irrespective of their quantity, small amount or large amount, dead or not, distinguishable or not have same ruling. This ruling is founded on the basis of Taba’iyyah (meaning, the follower reflects the ruling of origin).
According to Shafi’s and Hanbalis: It is permissible to eat worms that are born in food such as vinegar and fruit on three conditions:
Firstly: It should be taken with the food, alive or dead, if it is eaten alone it is not permissible.
Secondly: It should not be separated on its own, if it is taken away on its own, then eating it is not permissible. These two conditions also include the meaning of Taba’iyyah.
Thirdly: If the worm does not change the taste of the food, or its color, or smell, if it is liquid. If one of these factors changes then it is not permissible to eat or drink it, because of its impurity at that point. The analogy of weevils is placed on worms which breed in dates and beans if they are cooked, for what does not change the water is permissible to eat. Likewise the ant and so that falls in honey if is later cooked. Ahmad said regarding beans that have worms: avoiding it is more desirable to me, but if the water does not get dirty then it may be permitted.
Ahmad also said about checking dates with worms: There is no harm in it, and a hadith was narrated in that regard :(The Prophet ﷺ was brought some old dates he began to examine them and remove the worms from them) Ibn Qudaama said: this opinion is the best.