Lights turn on when set for specific time but not sunset

Automation working for a switch when set to specifi time but not sunset.