fixed bug in midnightToTime# function