If a Muslim intends to fast one day and starts to fast, then he decides to break the fast, he may do so, because completing a voluntary fast is not obligatory, but it is mustahabb for him to complete it if there is no excuse. If there is an excuse or an interest to be served by breaking the fast, there is nothing wrong with doing so in this case, and the fasting person who broke his fast will be rewarded – in sha Allah – for what he intended of serving a shar‘i interest, such as if he wanted to be kind to a friend of his who would be offending by his not eating food offered when visiting him or not accepting his invitation, or if he wanted to do an act of worship that fasting made him too weak to do, and it could bring him more reward than observing the naafil fast, and so on.
But we have not come across anything to indicate that he will be given the reward in full like one who actually fasted; rather what seems to be the case is that he will be rewarded for his intention, and the reward is according to the intention; it is not the same as the reward of one who had the intention and did the action.
For more information please see the answer to question no. 49610.
The more correct view is that the intention of breaking the fast to accept an invitation the next day means that one cannot form the intention to fast that day.
Based on that, it is not valid for one who has decided to accept an invitation to eat on a particular day to form the intention of fasting on that day from the night before.
Fasting does not prevent one from accepting an invitation; rather it is permissible for one who receives an invitation when he is fasting to offer du‘aa’ for the one who invited him and not break his fast. Thus the fasting person will maintain his habitual fast whilst also accepting his friend’s invitation. But if he knows that the one who is inviting him has gone to some effort for his sake and that if he does not eat when visiting him it will upset his friend, then it is mustahabb for him to break his naafil fast and eat with his friend.
And Allah knows best.