I have read a story in blog of Yama dying and entering the afterlife where he becomes the lord of the dead and Yami mourning over him.
The gods try to pacify her but she says "Yama died today!"
So to help her cope with her grief the gods create the Night (for previously there was only day in the beginning). Another variation of this story says the Gods created the Night and made Yami its deity.
Does anybody know if this story has a scriptural basis?