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.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login