Iyas bin Salama reported,

The Messenger of Allah ﷺ said, "Whenever a man and a woman agree to enter into a temporary marriage, their companionship together is for three nights. If they then wish to extend it, they may extend it, and if they wish to part, they may part."I do not know whether this was something granted specifically to us or to people generally.Abu Abdullah said, Ali clarified, on the authority of the Prophet ﷺ, that this ruling has been abrogated.

Bukhari 5119

Sahih

وقال ابن أبي ذئب

حدثني إياس بن سلمة بن الأكوع عن أبيه

عن رسول الله ﷺ أيما رجل وامرأة توافقا فعشرة ما بينهما ثلاث ليال فإن أحبا أن يتزايدا أو يتتاركا تتاركا فما أدري أشيء كان لنا خاصة أم للناس عامة قال أبو عبد الله وبينه علي عن النبي ﷺ أنه منسوخ

البخاري 5119صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Marriage
Chapter
Messenger of Allah ﷺ forbade temporary marriage at the end
Numbering
Darussalam 5119
Bukhari 5119