It was narrated that Al-Bara' said:"We prayed toward Bait Al-Maqdis (Jerusalem) with the Messenger of Allah (ﷺ) for sixteen or seventeen months - Safwan was not sure - then it was changed to the Qiblah."
أَخْبَرَنَا مُحَمَّدُ بْنُ بَشَّارٍ، قَالَ حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ، حَدَّثَنَا سُفْيَانُ، قَالَ حَدَّثَنَا أَبُو إِسْحَاقَ، عَنِ الْبَرَاءِ، قَالَ صَلَّيْنَا مَعَ النَّبِيِّ صلى الله عليه وسلم نَحْوَ بَيْتِ الْمَقْدِسِ سِتَّةَ عَشَرَ شَهْرًا أَوْ سَبْعَةَ عَشَرَ شَهْرًا - شَكَّ سُفْيَانُ - وَصُرِفَ إِلَى الْقِبْلَةِ .
Nesai
The Book of Salah • Hadith 488