Al-Aswad bin Hilal said: A man came to Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) and said: O Abu Abd al-Rahman, I was in a state of janabah and did not take a ritual bath until morning came. Sayyiduna Abdullah (may Allah be pleased with him) said: "You were in janabah, so the prayer was not permitted for you; then you took a ritual bath, so the prayer became permitted for you, and fasting also became permitted for you." And that (happened) in Ramadan.
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 9533