The Messenger of Allaah (sallallaahu alayhi wa sallam) said:
He who takes an oath to obey Allaah, then let him obey Allaah. And he who takes an oath to disobey Allaah, then he is not to disobey Allaah.
[Musnad Ahmad 25877]
Arabic of Hadith
حدثنا ابن نمير، قال: حدثنا يحيى بن سعيد، عن طلحة بن عبد الملك، عن القاسم بن محمد، عن عائشة قالت: قال رسول الله صلى الله عليه وسلم: من نذر أن يطيع الله عز وجل فليطعه، ومن نذر أن يعصي الله عز وجل، فلا يعصه
Explanation of Hadith
If a person takes on an oath to fast for three days or for an entire month, pray so many units of optional prayer, give so much in charity, etc., then it is incumbent upon him to fulfill his vow because all of the mentioned things and those similar to them come under obeying Allaah.
But if someone takes an oath not to ever talk to a Muslim brother or to not listen to ones parents, then he is not to carry out such an oath as it falls under disobeying Allaah. One cannot forsake a Muslim brother for more than three days, and one cannot refuse to listen to ones parents when they tell one to do something which is not against the rules of Islamic legislation.
Similarly, if one takes an oath to fast on the day of 'Eid, then it is not permissible to act on his oath because fasting on 'Eid is not permitted. It comes under disobedience of Allaah.