Merge pull request #2388 from drewski3420/no_negative_zero

No negative zero
This commit is contained in:
Michael Teeuw 2021-01-07 12:41:30 +01:00 committed by GitHub
commit 6f0f75cf27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 3 deletions

View File

@ -117,6 +117,7 @@ Special thanks to the following contributors: @bryanzzhu, @bugsounet, @chamakura
- Cleaned up clock tests.
- Move lodash into devDependencies, update other dependencies.
- Switch from ical to node-ical library.
- Convert `-0` to `0` when displaying temperature.
### Fixed

View File

@ -593,6 +593,7 @@ Module.register("currentweather", {
*/
roundValue: function (temperature) {
var decimals = this.config.roundTemp ? 0 : 1;
return parseFloat(temperature).toFixed(decimals);
var roundValue = parseFloat(temperature).toFixed(decimals);
return roundValue === "-0" ? 0 : roundValue;
}
});

View File

@ -178,7 +178,8 @@ Module.register("weather", {
roundValue: function (temperature) {
var decimals = this.config.roundTemp ? 0 : 1;
return parseFloat(temperature).toFixed(decimals);
var roundValue = parseFloat(temperature).toFixed(decimals);
return roundValue === "-0" ? 0 : roundValue;
},
addFilters() {

View File

@ -462,7 +462,8 @@ Module.register("weatherforecast", {
*/
roundValue: function (temperature) {
var decimals = this.config.roundTemp ? 0 : 1;
return parseFloat(temperature).toFixed(decimals);
var roundValue = parseFloat(temperature).toFixed(decimals);
return roundValue === "-0" ? 0 : roundValue;
},
/* processRain(forecast, allForecasts)