The Prophet ﷺ stayed for nineteen days shortening his prayers, so when we travel for nineteen days we shorten our prayers, and if we exceed that, we complete them in full.
أقام النبي ﷺ التسعة عشر يقصر، فنحن إذا سافرنا تسعة عشر قصرنا، وإن زدنا أتممنا.
Bukhari narrated it in "Shortening the Prayer" (1080) through the route of Abu Awana, from Aasim and Husayn, from Ikrima, from Ibn Abbas, as mentioned. Abu Dawud and others narrated it, and in their version it reads "seventeen." Bayhaqi said (3/151), "These narrations differ between 'nineteen' and 'seventeen.' In my view the more sahih of the two is the narration of those who said 'nineteen,' which is the narration that Muhammad bin Ismail Bukhari included in Jami Sahih. Those who narrated it did so consistently, without disagreement, going back to Abdullah bin Mubarak, who was the most retentive of those who narrated it from Aasim Ahwal." End of quote.He is referring to what Bukhari narrated in "Military Expeditions" (4298), from Abdan, from Abdullah (Ibn Mubarak), who said, Aasim informed us, from Ikrima, from Ibn Abbas, that the Prophet ﷺ stayed in Makkah for nineteen days, praying two rakahs. End of quote.I say, Abu Awana followed him in this, as you can see, and so did Abu Shihab, Bukhari (4299), both of them narrating from Aasim in the same way as the narration of Abdullah bin Mubarak. For more detail, see Minna Kubra (2/138).As for Ibn Abbas's statement, "If we stay longer, we complete the prayer in full," Abu Hanifa said something similar, except that he set the limit at fifteen days. In one narration reported by Ahmad, Malik, and Shafii, if a person intends to stay four days, he becomes a resident, because the Prophet ﷺ stayed in Makkah before the Hajj for four days shortening his prayers, since he arrived on the morning of the fourth of Dhul-Hijjah while the pilgrims were reciting the pilgrimage chants. This is also the view of more than one scholar. Some scholars held that there is no fixed limit at all, for it has been established that more than one companion of the Messenger of Allah ﷺ and more than one of the Followers used to shorten the prayer without setting any limit on the duration. This is the position chosen by Sheikh Islam bin Taymiya, may Allah have mercy on him, for he said, "The prayer is shortened in anything called travel, whether it is short or long, and no time limit is set for it. This is the view of the Zahiri school, and the author of Mughni supported it, and it applies whether the travel is permissible or forbidden. Ibn Aqeel supported this view in one place. Some later scholars among the followers of Ahmad and Shafii said that it makes no difference whether one intends to stay more than four days or not, and this has been reported from a group of the companions." Ikhtiyarat Fiqhiyya of Sheikh Islam (p. 69).I say, Anas bin Malik stayed in Syria for two months praying two rakahs. Ibn Umar stayed in Azerbaijan for six months shortening the prayer. Saad bin Abu Waqqas came as a delegate to Muawiya and stayed with him for a month shortening the prayer, or for the month of Ramadan, breaking his fast. It is reported from Hasan that he said, "We were with Abdul-Rahman bin Samura in some of the lands of Faris for two years, and he never combined prayers, nor did he ever pray more than two rakahs." It is also reported from Hasan that he stayed with Anas bin Malik in Nishapur for two years, and Anas used to pray two rakahs at a time.The most cautious position, as some learned scholars have said, is that if a person stays in a town for four days he should pray the prayer in full, so as to avoid the difference of opinion.