Weather API change backgrounds according to day and night

I have tried to figure this out on my own with no luck. I am using the FCC pass through. I have my backgrounds changing but they are all daytime pics looks funny when you look at it at night. Was thinking I could do an If to check if the icon was a day icon or night icon. Can’t for the life of me figure out how to check it.
Here is my Codepen: [https://codepen.io/Tamtamwilson/full/wPZJMK/]

I was thinking that after I asked. lol Actually I was think of making a sunset pic and setting a timer for it and thought duh I could just use Sunrise and Sunset. Would it be easier if I made sunrise and sunset a function? Thanks for the side note! Something else for me to work on lol

Was just brainstorming about different things I could do lol I got it I think! Need to plug in the right images. Thank you for your help! My images are acting strange on my phone. I think it is because of the loading animation. you can see the whole pic for a split second and it resizes and clips it off.

Well I thought I had it til I woke up and looked at it this morning and saw a night picture. Not sure what I did wrong.