It depends. It can last a day, a week, a month, or even longer.
Consider that it's "just" a mood disorder, where mood management can be affected by random stimuli. So, their mood might be stable until some stimulus comes by. And that stimulus could just be a random memory, which can create a feedback loop. It's "fun".
I have bipolar disorder, and the behavior of these "brilliant" engineers working late at night and exhausting themselves for days runs very true for me. It's really the only way that I've found to work successfully in any sort of deep manner. Essentially, this sort of behavior is in response to my disorder.
Mental health disorders are very, very, very, very hard. Not giving engineers with mental health disorders the room that they need to grow is doing everyone a disservice. And yet, the stigma around mental health disorders is so high that that conversation will not happen anytime in my lifetime. At the end of the day, myself and the others like me, are pushed into the dark further and further. It really sucks, and the only place for conversation about it is in therapy and close friends. Mentioning it at work leads to risk of retaliation. So, we cope. And then people write blogs about people like us, without taking into consideration that there's likely some mental health issue going on.
And, for what it's worth, talking about things in terms of MBTI isn't helpful in a conversation about mental health disorders. You might as well be talking about horoscopes.
Consider that it's "just" a mood disorder, where mood management can be affected by random stimuli. So, their mood might be stable until some stimulus comes by. And that stimulus could just be a random memory, which can create a feedback loop. It's "fun".