The Messenger of Allah ﷺ would sometimes become ritually impure during the night while intending to fast. He would then bathe after dawn had broken and complete his fast.
حدثنا يحيى عن عبد الملك حدثنا عطاء
كان رسول الله ﷺ تصيبه الجنابة من الليل وهو يريد الصوم فيغتسل بعدما يطلع الفجر ثم يتم صيامه
No references are available.
Its isnad is sahih, and it is like the preceding one.