I would wager that the ultimate source of this saying is Man's Search for Meaning by Viktor Frankl. The book describes the author's experiences as an inmate in several Nazi death camps. In this short work, one can find the following passage:
I once had a dramatic demonstration of the close link between the loss of faith in the future and this dangerous giving up. F, my senior block warden, a fairly well-known composer and librettist, confided in me one day: 'I
would like to tell you something, Doctor. I have had a strange dream. A voice told me that I could wish for something, that I should only say what I wanted
to know, and all my questions would be answered. What do you think I
asked? That I would like to know when the war would be over for me. You know what I mean, Doctor - for me! I wanted to know when we, when our camp, would be liberated and our sufferings come to an end.'
'And when did you have this dream?' I asked.
'In February, 1945,' he answered. It was then the beginning of March.
'What did your dream voice answer?"
Furtively he whispered to me, "March thirtieth."
When F told me about his dream, he was still full of hope and convinced that the voice of his dream would be right. But as the promised day drew nearer, the war news which reached our camp made it appear very unlikely that
we would be free on the promised date. On March twenty-ninth, F suddenly became ill and ran a high temperature. On March thirtieth, the day his
prophecy had told him that the war and suffering would be over for him, he
became delirious and lost consciousness. On March thirty-first, he was dead. To all outward appearances, he had died of typhus.