In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
In responding to your question, Sheikh Ahmad Kutty, a senior lecturer and Islamic scholar at the Islamic Institute of Toronto, Ontario, Canada, states:
If you mistakenly break your fasting before the sunset, then you need not worry as long as you stopped eating. If however, you continued to do so after recognizing your error, then you ought to make up for the day.
The Prophet (peace be upon him) said, “Allah excuses my community of mistakes or forgetfulness or actions done under coercion.” (Ibn Hibban)
Almighty Allah knows best.