كتاب الصيام
13  
The Book of Fasting
(32)
Chapter: It is permissible to observe a voluntary fast with an intention formed during the day before the sun reaches its Zenith, and it is permissible for one who is observing a voluntary fast to break his fast with no excuse, although it is better for him to complete it
(32)
بَاب جَوَازِ صَوْمِ النَّافِلَةِ بِنِيَّةٍ مِنْ النَّهَارِ قَبْلَ الزَّوَالِ وَجَوَازِ فِطْرِ الصَّائِمِ نَفْلًا مِنْ غَيْرِ عُذْرٍ
Sahih Muslim 1154 a

'A'isha, the Mother of the Believers (Allah be pleased with her), reported that one day the Messenger of Allah may peace be upon him) said to me:

'A'isha, have you anything (to eat)? I said: 'Messenger of Allah, there is nothing with us. Thereupon he said: I am observing fast. She said: The Messenger of Allah (ﷺ) went out, and there was a present, for us and (at the same time) some visitors dropped in. When the Messenger of Allah (ﷺ) came back, I said to him: Messenger of Allah, a present was given to us, (and in the meanwhile) there came to us visitors (a major Portion of it has been spent on them), but I have saved something for you. He said: What is it? I said: It is hais (a compound of dates and clarified butter). He said: Bring that. So I brought it to him and he ate it and then said: I woke up in the morning observing fast. Talha said: I narrated this hadith to Mujahid and he said: This (observing of voluntary fast) is like a person who sets apart Sadaqa out of his wealth. He may spend it if he likes, or he may retain it if he so likes.
وَحَدَّثَنَا أَبُو كَامِلٍ، فُضَيْلُ بْنُ حُسَيْنٍ حَدَّثَنَا عَبْدُ الْوَاحِدِ بْنُ زِيَادٍ، حَدَّثَنَا طَلْحَةُ، بْنُ يَحْيَى بْنِ عُبَيْدِ اللَّهِ حَدَّثَتْنِي عَائِشَةُ بِنْتُ طَلْحَةَ، عَنْ عَائِشَةَ أُمِّ الْمُؤْمِنِينَ، - رضى الله عنها - قَالَتْ قَالَ لِي رَسُولُ اللَّهِ صلى الله عليه وسلم ذَاتَ يَوْمٍ ‏"‏ يَا عَائِشَةُ هَلْ عِنْدَكُمْ شَىْءٌ ‏"‏ ‏.‏ قَالَتْ فَقُلْتُ يَا رَسُولَ اللَّهِ مَا عِنْدَنَا شَىْءٌ ‏.‏ قَالَ ‏"‏ فَإِنِّي صَائِمٌ ‏"‏ ‏.‏ قَالَتْ فَخَرَجَ رَسُولُ اللَّهِ صلى الله عليه وسلم فَأُهْدِيَتْ لَنَا هَدِيَّةٌ - أَوْ جَاءَنَا زَوْرٌ - قَالَتْ - فَلَمَّا رَجَعَ رَسُولُ اللَّهِ صلى الله عليه وسلم قُلْتُ يَا رَسُولَ اللَّهِ أُهْدِيَتْ لَنَا هَدِيَّةٌ - أَوْ جَاءَنَا زَوْرٌ - وَقَدْ خَبَأْتُ لَكَ شَيْئًا ‏.‏ قَالَ ‏"‏ مَا هُوَ ‏"‏ ‏.‏ قُلْتُ حَيْسٌ ‏.‏ قَالَ ‏"‏ هَاتِيهِ ‏"‏ ‏.‏ فَجِئْتُ بِهِ فَأَكَلَ ثُمَّ قَالَ ‏"‏ قَدْ كُنْتُ أَصْبَحْتُ صَائِمًا ‏"‏ ‏.‏ قَالَ طَلْحَةُ فَحَدَّثْتُ مُجَاهِدًا بِهَذَا الْحَدِيثِ فَقَالَ ذَاكَ بِمَنْزِلَةِ الرَّجُلِ يُخْرِجُ الصَّدَقَةَ مِنْ مَالِهِ فَإِنْ شَاءَ أَمْضَاهَا وَإِنْ شَاءَ أَمْسَكَهَا‏.‏
Reference : Sahih Muslim 1154a
In-book reference : Book 13, Hadith 220
USC-MSA web (English) reference : Book 6, Hadith 2573
  (deprecated numbering scheme)