Lighting automation resets at midnight

I am using a new smartthings motion sensor and an IKEA Tradfri bulb along with the smart lighting smart app to turn the light on when motion is detected an hour before sunset until 10p.m. This works fine until midnight when the light then starts coming on and flickers continuosly until I switch it off. I have attached a screenshot of the automation I have made and one showing timings using the new app. Any one know where I am going wrong?

The automation you included looks correct. Do you have other automation or smartapp setup using this light?

The only other automation I have is if one of my smoke detectors goes off it will turn every light in the house on.