Giter VIP home page Giter VIP logo

Comments (4)

rourke avatar rourke commented on September 16, 2024

If you want rounded numbers in the temperature you can change this in weather-card.js on line 168:

: stateObj.attributes.temperature}</span

to

: Math.round(stateObj.attributes.temperature)}</span

For Fahrenheit it seems to already round the numbers.

from weather-card.

smugleafdev avatar smugleafdev commented on September 16, 2024

At the moment I'm using Fahrenheit and it is displaying one digit after the decimal point for the forecast highs and lows. I was hoping for an option to display those rounded as well.

from weather-card.

smugleafdev avatar smugleafdev commented on September 16, 2024

Update: So I wrote my code to round the numbers correctly. Unfortunately, it seems that modifying the .js file on a card installed via HACS doesn't change anything. Instead, I had to uninstall the card from HACs and install it manually, and then modify lines 282 and 287.

<div class="highTemp">
  ${Math.round(daily.temperature)}${this.getUnit("temperature")}
...
<div class="lowTemp">
  ${Math.round(daily.templow)}${this.getUnit("temperature")}

from weather-card.

CodingSquirrel avatar CodingSquirrel commented on September 16, 2024

I ended up doing something similar, decimal precision isn't necessary for predicted temperatures.

Update: So I wrote my code to round the numbers correctly. Unfortunately, it seems that modifying the .js file on a card installed via HACS doesn't change anything.

For future reference, you don't need to go through the trouble of uninstalling if you want to edit the js file. Generally a gz file is used to save bandwidth when transferring the file to clients, which you can find in the same directory. You can either delete that or gzip your updated file and it will be picked up. gzip -kf weather-card.js

from weather-card.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.