Sayyiduna Salamah bin al-Akwa' (may Allah be pleased with him) narrated: In the time of the Messenger of Allah (peace and blessings be upon him), during Ramadan we used to do this: whoever wished would fast, and whoever wished would not fast and would feed a poor person in its place, until this verse was revealed: "So whoever among you witnesses the month, let him fast it." [Surah al-Baqarah: 185]
Hadith Referenceالمعجم الكبير للطبراني / باب السين / 6275