The Messenger of Allah ﷺ stayed in Mecca for seventeen days, shortening the prayer. Ibn Abbas said, "Whoever stays seventeen days should shorten the prayer, and whoever stays longer should pray it in full."
حدثنا محمد بن العلاء وعثمان بن أبي شيبة المعنى واحد قالا حدثنا حفص عن عاصم عن عكرمة
أن رسول الله ﷺ أقام سبع عشرة بمكة يقصر الصلاة قال ابن عباس ومن أقام سبع عشرة قصر ومن أقام أكثر أتم
Bukhari collected it in the Book of Shortening the Prayer, chapter titled "What Has Been Related Concerning Shortening the Prayer" etc., hadith no. 1080, from the hadith of Asim, with the same chain.