Wanderlust Project - Celsus


In the Wanderlust project, I am trying to change the temperature from Fahrenheit to Celsius. I know that the API return a JSON with both options. But I can’t find a way in my code to make this change.

Can someone help me?

In public/helper.js change ${currentDay.day.maxtemp_f} to ${currentDay.day.maxtemp_c} and then do the same for ${currentDay.day.mintemp_f}

You can also modify the createWeatherHTML() helper function provided - converting from Kelvin to Celsius is straightforward:

const kelvinToCelsius = k => (k - 273.15).toFixed(0);

then just replace:

<h2>Temperature: ${kelvinToFahrenheit(currentDay.main.temp)}&deg;F</h2>

<h2>Temperature: ${kelvinToCelsius(currentDay.main.temp)}&deg;C</h2>

I’m going to try and add a toggle to the HTML page… :slight_smile: