When Allah's Apostle ﷺ came back from the Battle of Hunain, Umar asked Messenger of Allah ﷺ about the vow he had taken during the days of Ignorance that he would observe I'tikaf for a day. The rest of the hadith is the same.
لَمَّا قَفَلَ النَّبِيُّ ﷺ مِنْ حُنَيْنٍ سَأَلَ عُمَرُ رَسُولَ اللَّهِ ﷺ عَنْ نَذْرٍ كَانَ نَذَرَهُ فِي الْجَاهِلِيَّةِ اعْتِكَافِ يَوْمٍ ثُمَّ ذَكَرَ بِمَعْنَى حَدِيثِ جَرِيرِ بْنِ حَازِمٍ