Sayyiduna Anas bin Malik (may Allah be pleased with him) said: Old dates were brought to the Prophet (peace and blessings be upon him), and he (peace and blessings be upon him) was searching through them and taking out the worms.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصداق / 14634
Ishaq bin Abdullah bin Abi Talhah narrates that dates containing worms were given to the Messenger of Allah (peace and blessings be upon him).
(b) Ibn Umar (may Allah be pleased with them both) narrates from the Prophet (peace and blessings be upon him) the prohibition of splitting a date open (to see) what is inside it. If this is authentic, then what is meant by it, and Allah knows best, is when the dates are fresh; and what we have narrated concerns dates that are old.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصداق / 14635