Ayesha reported,

Umar was mistaken. The Messenger of Allah ﷺ only forbade deliberately timing prayer to coincide with the rising and setting of the sun.

Muslim 1931

Sahih

حدثنا محمد بن حاتم حدثنا بهز حدثنا وهيب حدثنا عبد الله بن طاوس عن أبيه

عن عائشة أنها قالت

وهم عمر إنما نهى رسول الله ﷺ أن يتحرى طلوع الشمس وغروبها

مسلم 1931صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Virtues of the Quran and what relates to it
Chapter
Do not seek the rising or setting of the sun for your prayer
Numbering
Darussalam 1931
Muslim 1931