Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:65:4

And those who no longer expect menstruation among your women - if you doubt, then their period is three months, and ˹also for˺ those who have not menstruated. And for those who are pregnant, their term is until they give birth. And whoever fears Allah - He will make for him of his matter ease.  

And ˹as for˺ those of your women who (read allā’ī or allā’i in both instances) no longer expect to menstruate, if you have any doubts, about their waiting period, their prescribed ˹waiting˺ period shall be three months, and ˹also for˺ those who have not yet menstruated, because of their young age, their period shall ˹also˺ be three months — both cases apply to other than those whose spouses have died; for these ˹latter˺ their period is prescribed in the verse: they shall wait by themselves for four months and ten ˹days˺ ˹Q. 2:234˺. And those who are pregnant, their term, the conclusion of their prescribed ˹waiting˺ period if divorced or if their spouses be dead, shall be when they deliver. And whoever fears God, He will make matters ease for him, in this world and in the Hereafter.
القرآن:٦٥:٤

وَاللَّائِي يَئِسْنَ مِنَ الْمَحِيضِ مِنْ نِسَائِكُمْ إِنِ ارْتَبْتُمْ فَعِدَّتُهُنَّ ثَلَاثَةُ أَشْهُرٍ وَاللَّائِي لَمْ يَحِضْنَ ۚ وَأُولَاتُ الْأَحْمَالِ أَجَلُهُنَّ أَنْ يَضَعْنَ حَمْلَهُنَّ ۚ وَمَنْ يَتَّقِ اللَّهَ يَجْعَلْ لَهُ مِنْ أَمْرِهِ يُسْرًا  

(واللائي) بهمزة وياء وبلا ياء في الموضعين (يئسن من المحيض) بمعنى الحيض (من نسائكم إن ارتبتم) شككتم في عدتهن (فعدتهن ثلاثة أشهر واللائي لم يحضن) لصغرهن فعدتهن ثلاثة أشهر والمسألتان في غير المتوفي عنهن أزواجهن أما هن فعدتهن ما في آية "" يتربصن بأنفسهن أربعة أشهر وعشرا "" (وأولات الأحمال أجلهن) انقضاء عدتهن مطلقات أو متوفى عنهن أزواجهن (أن يضعن حملهن ومن يتق الله يجعل له من أمره يسرا) في الدنيا والآخرة.

See similar narrations below:

Collected by Bayhaqī
bayhaqi:15442Abū ʿAlī al-Rūdhbārī > Abū Bakr b. Dāsah > Abū Dāwud > Aḥmad b. Muḥammad al-Marwazī > ʿAlī b. Ḥusayn from his father > Yazīd al-Naḥwī > ʿIkrimah > Ibn

Women who are divorced shall wait, keeping themselves apart, three monthly courses; and then said: And for such of your women as despair of menstruation, if ye doubt, their period (of waiting) shall be three months. This was abrogated from the former verse. Again he said: (O ye who believe, if ye wed believing women) and divorce them before ye have touched them, then there is no period that ye should reckon." (Using translation from Abū Dāʾūd 2282)   

البيهقي:١٥٤٤٢أَخْبَرَنَا أَبُو عَلِيٍّ الرُّوذْبَارِيُّ أنا أَبُو بَكْرِ بْنُ دَاسَةَ نا أَبُو دَاوُدَ نا أَحْمَدُ بْنُ مُحَمَّدٍ الْمَرْوَزِيُّ نا عَلِيُّ بْنُ حُسَيْنٍ عَنْ أَبِيهِ عَنْ يَزِيدَ النَّحْوِيِّ عَنْ عِكْرِمَةَ عَنِ ابْنِ عَبَّاسٍ ؓ

فِي قَوْلِهِ تَعَالَى {وَالْمُطَلَّقَاتُ يَتَرَبَّصْنَ بِأَنْفُسِهِنَّ ثَلَاثَةَ قُرُوءٍ} [البقرة 228] قَالَ {وَاللَّائِي يَئِسْنَ} [الطلاق 4] مِنَ الْمَحِيضِ مِنْ نِسَائِكُمْ إِنِ ارْتَبْتُمْ فَعِدَّتُهُنَّ ثَلَاثَةُ أَشْهُرٍ وَاللَّائِي لَمْ يَحِضْنَ فَنَسَخَ مِنْ ذَلِكَ وَقَالَ {وَإِنْ طَلَّقْتُمُوهُنَّ مِنْ قَبْلِ أَنْ تَمَسُّوهُنَّ} [البقرة 237] {فَمَا لَكُمْ عَلَيْهِنَّ مِنْ عِدَّةٍ} [الأحزاب 49] تَعْتَدُّونَهَا