Weather app problems

Weather app problems
0.0 0

#1

I’m stuck with the weather app assignment. The app uses the darksky API (https://darksky.net/dev/docs) and it shows the current temperature, the corresponding icon for the weather, location, chance of rain and wind but I don’t know how to get the temperature units from the API (C/F) so that I can convert them, right now it’s set to auto, so it shows the temp in C or F depending on the location but not the units. Does anyone know how to do that? Or maybe an alternative way of going about it?

Thanks in advance

Link to my codepen:


How do we detect F or C in the data returned in the weather app?
#2

In your data1 response object , I see a property there called flags which has a sub-property called units , or data1.flags.units, currently (since I am in the US it is set to us), I am assuming it will correspondingly be set to metric depending on location, either way that should correspond to what units you are getting and you could use that to convert accordingly


#3

Thanks so much! I don’t why I couldn’t see it and in hindsight it was kind of obvious. Thanks!