The verse was revealed as "And eat and drink until the white thread becomes distinct to you from the black thread" [Baqarah 2:187], and the words "of the dawn" had not yet been sent down. So there were men who, when they wished to fast, would tie a white thread and a black thread to their legs, and one would keep eating until he could clearly see the two of them. Then Allah afterward revealed the words "of the dawn" [Baqarah 2:187], and they understood that what was meant was simply night and day.
أنزلت: {وكلوا واشربوا حتى يتبين لكم الخيط الأبيض من الخيط الأسود}. ولم ينزل {من الفجر}، فكان رجال إذا أرادوا الصوم ربط أحدهم في رجله الخيط الأبيض والخيط الأسود، ولم يزل يأكل حتى يتبين له رؤيتهما، فأنزل الله بعد من {الفجر} فعلموا أنه إنما يعني الليل والنهار.
Bukhari narrated it in the Book of Fasting (1917), and Muslim in the Book of Fasting (1091), both through the route of Saeed bin Abu Maryam, Bukhari's teacher, who said, Abu Ghassan Muhammad bin Mutarrif narrated to us, he said, Abu Hazim narrated to me, from Sahl bin Saad, with this chain, and he related it. The wording given is Bukhari's. Abu Hazim is Salama bin Dinar al-Madani.