Birds need to be kept at a strict solar schedule and that means exposure to dawn and dusk without any artificial lights on (not even a TV or a computer screen) and go to sleep when night falls. Think of the chickens and the birds outside on the trees...
The reason for this is that they are photoperiodic so they regulate their glandular functions by the number of hours the sun is shining. If you keep a bird exposed to light after the sun goes down, the bird's body will 'think' it's the middle of the summer and continue producing sexual hormones instead of stopping which causes them pain, frustration and puts them in a real bad mood.
Here is an excerpt from Wikipedia that will help you understand it better (they are using the canary and its song as an example but it applies to all birds and all their sexual behaviors -which, in parrots, unfortunately for us, is often aggression):
Quote
Daylength, and thus knowledge of the season of the year, is vital to many animals. A number of biological and behavioural changes are dependent on this knowledge. Together with temperature changes, photoperiod provokes changes in the colour of fur and feathers, migration, entry into hibernation, sexual behaviour, and even the resizing of sexual organs.
The singing frequency of birds such as the canary depends on the photoperiod. In the spring, when the photoperiod increases (more daylight), the male canary's testes grow. As the testes grow, more androgens are secreted and song frequency increases. During autumn, when the photoperiod decreases (less daylight), the male canary's testes regress and androgen levels drop dramatically, resulting in decreased singing frequency. Not only is singing frequency dependent on the photoperiod but the song repertoire is also. The long photoperiod of spring results in a greater song repertoire. Autumn's shorter photoperiod results in a reduction in song repertoire. These behavioral photoperiod changes in male canaries are caused by changes in the song center of the brain. As the photoperiod increases, the high vocal center (HVC) and the robust nucleus of the archistriatum (RA) increase in size. When the photoperiod decreases, these areas of the brain regress.
Unquote




