Open jsoucheiron opened 9 months ago
I have the same issue on my stream deck.
NaN at 0C here too.
it's due to main.js func prepareTemperature, which uses a conditional for undefined/null without testing the type - and so treats zero as "false"
e.g.
if (unit === 'celsius') { temp = response.current.temp_c ? response.current.temp_c.toFixed(roundDegree ? 0 : 2) + '°C' : 'NaN'; }
needs to be :
if (unit === 'celsius') { temp = typeof response.current.temp_c == 'number' ? response.current.temp_c.toFixed(roundDegree ? 0 : 2) + '°C' : 'NaN'; }
(and also do this for the other api and fahrenheit, if you need)
Sorry I can't do a PR, as I wouldn't be able to assert that the other apis still work, but I'd assume it would - and I leave this here so in the meantime folk can workaround if needed.
snip comment about current codebase fix being not sufficient
my mistake, i note that as the fix on github is not checking pure type equality with !==, it will work as expected even for undefined vars... I read too quickly and jumped to conclusions :)
additionally - my above "work around" failed entirely when the temperature last night at my local METAR went below zero 🤦
Hey, really nice plugin.
Today I had a NaN temp. I can't be 100% sure but I'm almost sure it's caused by a 0ºC temperature.