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."
أخبرنا عبد الله بن الصباح قال حدثنا محمد بن سواء قال أنبأنا سعيد عن أيوب عن نافع عن صفية بنت أبي عبيد
أن النبي ﷺ قال لا يحل لامرأة تؤمن بالله واليوم الآخر تحد على ميت أكثر من ثلاثة أيام إلا على زوج فإنها تحد عليه أربعة أشهر وعشرا
[Sahih]. It is in Sunan al-Kubra, hadith: 5697, see also the previous hadith. Saeed here is Ibn Arubah.