The Messenger of Allah ﷺ stayed in Tabuk for twenty days, shortening the prayer.
حدثنا عبد الرزاق أخبرنا معمر عن يحيى بن أبي كثير عن محمد بن عبد الرحمن بن ثوبان
أقام رسول الله ﷺ بتبوك عشرين يوما يقصر الصلاة
Its isnad is sahih. Muhammad bin Abdul-Rahman bin Thawban Amiri Qurashi is trustworthy and virtuous.Some jurists relied on this hadith and set twenty days as the limit for staying, beyond which it is not permissible to shorten the prayer.