The Prophet ﷺ said, "It is not lawful for a woman who believes in Allah and the Last Day to mourn for any deceased person more than three days, except for a husband, for whom she mourns four months and ten days."
أخبرنا محمد بن بشار قال حدثنا عبد الوهاب قال سمعت يحيى بن سعيد يقول سمعت نافعا يقول عن صفية بنت أبي عبيد أنها
عن النبي ﷺ قال لا يحل لامرأة تؤمن بالله واليوم الآخر تحد على ميت فوق ثلاث إلا على زوج فإنها تحد عليه أربعة أشهر وعشرا
Muslim reported it, in the Book of Divorce, chapter on the obligation of mourning during the waiting period after the death of a husband and its prohibition beyond that except for three days, no. 1490, from the hadith of Nafi with this wording, and it is in Kubra, no. 5696.