If you don't want to go full-blown Home Assistant or anything "smart", you can still handle this with a self-contained switch.
I installed a Honeywell similar to this one [1]. You tell it the date and your lat/long, and it knows the times for dawn and dusk.
I had a previous version of it 10 years ago [2]. Worked great.