The Messenger of Allah ﷺ said, "When one of you is fasting, he must not engage in vulgar speech or behave ignorantly. If someone treats him with ignorance, let him say, 'I am a man who is fasting.'"
حدثنا محمد بن الصباح أنبأنا جرير عن الأعمش عن أبي صالح
قال رسول الله ﷺ إذا كان يوم صوم أحدكم فلا يرفث ولا يجهل وإن جهل عليه أحد فليقل إني امرؤ صائم
Sahih.Amash was corroborated by Abu Husayn in Ahmad, 2/356, and Nasai in Kubra. Both of them were also corroborated by Ata bin Abu Rabah in Bukhari, no. 1904, and Muslim, no. 1151, and others, with similar wording, at greater length.