All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
Seeking refuge in Allah when hearing the barking of dogs and the braying of donkeys is not restricted to the nighttime only, but it includes the day as well.
Jaabir ibn ‘Abdullah narrated that the Prophet said, ‘‘If you hear the barking of dogs and the braying of donkeys at night, then seek refuge in Allah from the devil because they see what you do not see.’’ [Ahmad and Abu Daawood - Shaykh Al-Albaani classified it as saheeh (sound)]
Al-Munaawi said in Faydh Al-Qadeer, ‘‘'If you hear the barking of dogs or the braying of donkeys by night'; the Prophet mentioned the night in particular because it is during the nighttime that the devils and jinn spread more than the day, and they cause more corruption at night; so it is more appropriate to seek refuge with Allah during the night even though we should also seek refuge with Allah from them during the day.”
Allah knows best.