The Messenger of Allah ﷺ said, "Fasting is a shield. When one of you is fasting on a given day, he should not speak obscenely or behave foolishly. If someone insults him or tries to fight him, let him say, 'I am fasting.'"
حدثنا بهز حدثنا سليم بن حيان حدثنا سعيد
قال رسول الله ﷺ الصوم جنة فإذا كان أحدكم يوما صائما فلا يرفث ولا يجهل فإن امرؤ شتمه أو قاتله فليقل إني صائم
Its isnad is sahih. Saeed is Ibn Mina. The hadith is in Jami al-Masanid wal-Sunan 7:167, cited from this very place, and its meaning has already appeared several times, at length and in brief, including at 7679 and 7827.