The Messenger of Allah ﷺ said, "It is not lawful for a woman who believes in Allah and the Last Day to mourn for any deceased person beyond three days, except for a husband, for whom she mourns four months and ten days."
أخبرنا هناد بن السري عن وكيع عن شعبة قال حدثني حميد بن نافع عن زينب بنت أم سلمة قالت
رسول الله ﷺ يقول لا يحل لامرأة تؤمن بالله واليوم الآخر تحد على ميت فوق ثلاثة أيام إلا على زوج أربعة أشهر وعشرا
Bukhari narrated it in "Divorce," chapter on the use of kohl by a woman in mourning, hadith 5339, and Muslim in "Divorce," chapter on the obligation of mourning during the waiting period after death and its prohibition otherwise, except for three days, hadith 59/1486, from the hadith of Shubah, with this wording. It is also found in Al-Kubra, hadith 5693.