JSFiddle - React, Tailwind, and code Playground

HTML

<div class="weekday"></div>

JavaScript

const weekday = document.querySelector('.weekday');
const days = ['Sun', 'Mon', 'Tue', 'Wed', 'Thur','Fri', 'Sat', 'Sun'];


setInterval(() => {
const d = new Date();
const day = days[d.getDay()];

    async function showtime() {
    await getWeather();
    console.log(sunriseTime); // returns undefined
    console.log(day) // logs fine, returns Wednesday. 
        weekday.innerHTML = day + ', Sunrise at: ' + sunriseTime;
    }
    showtime();
}, 1000);

// 

const openweather_api = "https://api.openweathermap.org/data/2.5/weather?q=London&appid=23456789nits=metric";

async function getWeather() {
    console.log('run weather function first')
    const response = await fetch(openweather_api);  
    const json = await response.json();
    
    console.log(json.sys.sunrise);
    const sunriseTime = `${json.sys.sunrise}` // logs sunrise time in seconds. 

    }

getWeather(); // runs fine and retrieves values from Open Weather Json.