Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:18:17

And ˹had you been present˺, you would see the sun when it rose, inclining away from their cave on the right, and when it set, passing away from them on the left, while they were ˹laying˺ within an open space thereof. That was from the signs of Allah. He whom Allah guides is the ˹rightly˺ guided, but he whom He leaves astray - never will you find for him a protecting guide.  

And you might have seen the sun, when it rose, inclining (read tazzāwaru or tazāwaru) away from their Cave towards the right, side of it, and, when it set, go past them on the left, avoid them and pass over them, so that it does not fall on them at all, while they were in a cavern therein, in an ample space inside the Cave where the coolness and the gentle breeze of the winds reached them. That, which is mentioned, was ˹one˺ of God’s signs, ˹one of˺ the proofs of His power. Whomever God guides, he indeed is rightly guided, and whomever He leads astray, you will not find for him a guiding friend.
القرآن:١٨:١٧

وَتَرَى الشَّمْسَ إِذَا طَلَعَتْ تَزَاوَرُ عَنْ كَهْفِهِمْ ذَاتَ الْيَمِينِ وَإِذَا غَرَبَتْ تَقْرِضُهُمْ ذَاتَ الشِّمَالِ وَهُمْ فِي فَجْوَةٍ مِنْهُ ۚ ذَٰلِكَ مِنْ آيَاتِ اللَّهِ ۗ مَنْ يَهْدِ اللَّهُ فَهُوَ الْمُهْتَدِ ۖ وَمَنْ يُضْلِلْ فَلَنْ تَجِدَ لَهُ وَلِيًّا مُرْشِدًا  

{وترى الشمس إذا طلعت تزّاور} بالتشديد والتخفيف تميل {عن كهفهم ذات اليمين} ناحيته {وإذا غربت تقرضهم ذات الشمال} تتركهم وتتجاوز عنهم فلا تصيبهم ألبتة {وهم في فجوة منه} متسع من الكهف ينالهم برد الريح ونسيمها {ذلك} المذكور {من آيات الله} دلائل قدرته {من يهد الله فهو المهتد ومن يضلل فلن تجد له وليا مرشدا}.