A fasting person does not invalidate his fast if he does something to break his fast either in ignorance or out of forgetfulness.
Allah says: “There is no blame on you for what you do by mistake, but only for what your hearts have deliberately resolved upon.” [Sûrah al-Ahzâb: 5]
Also: “Our Lord! Do not take us to task if we forget or make a mistake.” [Sûrah al-Baqarah: 286]
The Prophet (peace be upon him) said: “Allah has pardoned my people for what they do by mistake or out of forgetfulness and for what they are coerced into doing.” [Sunan Ibn Mâjah (2043) and authenticated by al-Albânî in Sahîh al-Jâmi` (1731)]
The Prophet (peace be upon him) said: “Whoever forgets he is fasting and eats or drinks something should complete his fast, for it is merely that Allah has given him food and drink.” [Sahîh al-Bukhârî (1933) and Sahîh Muslim (1155)]
We also find in Sahîh al-Bukhârî where Asmâ’ bint Abî Bakr said: “We broke our fast on one overcast day in Ramadan during the time of Allah’s Messenger (peace be upon him), then the Sun reappeared.” [Sahîh al-Bukhârî (1959)]
It is not related that the Prophet (peace be upon him) ordered them to make up their fast. Therefore, if someone eats on a day of fasting believing that dawn has not yet arrived and then realizes that it has, his fast will be valid and he will not have to make up that fast on another day.