Read the statement by Michael Teeuw here.
Can I round Precipitation Units
-
Hey all,
Just curious if I’m able to round the showPrecipitationAmount units like I can with Temp units. I feel like there’s a way, but without a specific line in the documentation I didn’t want to start poking around since I know so little about coding in general. I’m a woodworker so this is all pretty new to me.
Thanks
-
I figured it out. I wanted to round it off too. No decimal places.
You have to edit the template files. look for the showPrecipitationAmount if statement. I altered the output a little bit… see below for what I did.in forecast.njk
{% if config.showPrecipitationAmount %} {% if f.precipitationUnits %} <td class="align-right bright precipitation"> {{ f.precipitation }}{{ f.precipitationUnits }} </td> {% else %} {% if f.pop %} <td class="align-right precipitation"> {{(f.pop * 100).toFixed(0)}}% </td> {% endif %} <td class="align-right bright precipitation"> {{ f.precipitation | unit("precip") }} </td> {% endif %} {% endif %}
I found info on the templates by googling nunchucks templates.
-
@amarko87 what module are you talking about ?
-
@sdetweil I probably should’ve mentioned that in the post. Just the default Weather module.
-
@amarko87 There’s currently no option to round precipitation amount in the default Weather module, although I think this should be possible. I’m just curious:
-
Which weather provider are you using?
-
Are you looking for rounding in the ‘forecast’ and/or ‘hourly’ feature of the Weather module?
-
-
I figured it out. I wanted to round it off too. No decimal places.
You have to edit the template files. look for the showPrecipitationAmount if statement. I altered the output a little bit… see below for what I did.in forecast.njk
{% if config.showPrecipitationAmount %} {% if f.precipitationUnits %} <td class="align-right bright precipitation"> {{ f.precipitation }}{{ f.precipitationUnits }} </td> {% else %} {% if f.pop %} <td class="align-right precipitation"> {{(f.pop * 100).toFixed(0)}}% </td> {% endif %} <td class="align-right bright precipitation"> {{ f.precipitation | unit("precip") }} </td> {% endif %} {% endif %}
I found info on the templates by googling nunchucks templates.