I’m in the process of building this app. I want to change the background image based on the user’s weather AND whether it’s day or night where they are. (if it’s clear and night time, I don’t wanna show an image of clear skies during the day). I know the FCC weather API pass through gives us sunrise and sunset time, but it’s for the next day. When I do:
var unixSunrise = result.sys.sunrise; var sunrise = new Date(unixSunrise*1000);
It gives me tomorrow’s sunrise. Same thing happens with sunset. How do I get the user’s current day’s sunrise and sunset times so that I display the appropriate background image?