During Ramadan, when a man fasted and reached the evening, then slept, food, drink, and intimacy with women became forbidden to him until he broke his fast the following day.One night, Umar bin Khattab returned home after staying up late with the Prophet ﷺ and found that his wife had already gone to sleep. He desired her, but she said, "I have already slept."He replied, "You have not slept," and then he had relations with her.Kaab bin Malik did the same thing. The next morning, Umar went to the Prophet ﷺ and informed him of what had happened. Then Allah the Exalted revealed, "Allah knows that you used to deceive yourselves, so He accepted your repentance and pardoned you" [Baqarah 2:187].
حدثنا عتاب بن زياد قال أخبرنا عبد الله قال أخبرنا ابن لهيعة قال حدثني موسى بن جبير مولى بني سلمة أنه سمع
كان الناس في رمضان إذا صام الرجل فأمسى فنام حرم عليه الطعام والشراب والنساء حتى يفطر من الغد فرجع عمر بن الخطاب من عند النبي ﷺ ذات ليلة وقد سهر عنده فوجد امرأته قد نامت فأرادها فقالت إني قد نمت قال ما نمت ثم وقع بها وصنع كعب بن مالك مثل ذلك فغدا عمر إلى النبي ﷺ فأخبره فأنزل الله تعالى {علم الله أنكم كنتم تختانون أنفسكم فتاب عليكم وعفا عنكم}
Its chain is hasan, due to Attab and Ibn Lahia. The hadith was narrated by Abu Dawud 2/295, no. 2313, and it is found with a similar meaning in Bukhari 4/129, no. 1915, Fath.