IBNHIBBAN 3664:
from Anas b. Mālik —
[Machine] The Messenger of Allah ﷺ used to observe Itikaf during the last ten days of Ramadan when he was staying in one place. However, when he traveled, he would observe Itikaf for twenty days in the following year.
ابن حبّان ٣٦٦٤:
عن انس بن مالك —
كَانَ رَسُولُ اللَّهِ ﷺ إِذَا كَانَ مُقِيمًا يَعْتَكِفُ الْعَشْرَ الْأَوَاخِرَ مِنْ رَمَضَانَ فَإِذَا سَافَرَ اعْتَكَفَ مِنَ الْعَامِ الْمُقْبِلِ عِشْرِينَ