A person died and Messenger of Allah ﷺ used to visit him. He died at night and (the people) buried him at night. In the morning they informed the Prophet (about his death). He said, "What prevented you from informing me?" They replied, "It was night and it was a dark night and so we disliked to trouble you." The Prophet ﷺ went to his grave and offered the (funeral) prayer.
مَاتَ إِنْسَانٌ كَانَ رَسُولُ اللَّهِ ﷺ يَعُودُهُ فَمَاتَ بِاللَّيْلِ فَدَفَنُوهُ لَيْلاً فَلَمَّا أَصْبَحَ أَخْبَرُوهُ فَقَالَ مَا مَنَعَكُمْ أَنْ تُعْلِمُونِي قَالُوا كَانَ اللَّيْلُ فَكَرِهْنَا وَكَانَتْ ظُلْمَةٌ أَنْ نَشُقَّ عَلَيْكَ فَأَتَى قَبْرَهُ فَصَلَّى عَلَيْهِ