Lunatic, is literally �moonstruck� and derived from lunaticus - meaning �living on the moon�. Today we might say �Away with the fairies�.
The term lunatic probably referred in ancient or bygone times, to the symptoms of cyclic mood disorders such as bipolar disorder or cyclothymia, the symptoms of which also go through phases. But as yet there is little evidence for any causal link between phases of the moon and the progression of mood disorder symptoms.
Needless to say, neither illnesses, which are both linked to depression and hypomania are joking matters for many sufferers.