mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-18 07:34:54 +00:00
dateMenu: Fix temperature edge case
We currently format the temperature with a precision of 0, that is
with no digits after the decimal-point. As a result, a temperature
like -0.2 shows up as -0.
Math.trunc() has the same effect as `%.0f` and handles that edge
case correctly, but while at it, we can just as well round the
value properly.
https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3441
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1548>
(cherry picked from commit e85d127ae3)
This commit is contained in:
parent
05f051e00e
commit
906a0d1131
1 changed files with 2 additions and 2 deletions
|
|
@ -381,7 +381,7 @@ class WeatherSection extends St.Button {
|
|||
ampm: false,
|
||||
});
|
||||
const [, tempValue] = fc.get_value_temp(GWeather.TemperatureUnit.DEFAULT);
|
||||
const tempPrefix = tempValue >= 0 ? ' ' : '';
|
||||
const tempPrefix = Math.round(tempValue) >= 0 ? ' ' : '';
|
||||
|
||||
let time = new St.Label({
|
||||
style_class: 'weather-forecast-time',
|
||||
|
|
@ -396,7 +396,7 @@ class WeatherSection extends St.Button {
|
|||
});
|
||||
let temp = new St.Label({
|
||||
style_class: 'weather-forecast-temp',
|
||||
text: '%s%.0f°'.format(tempPrefix, tempValue),
|
||||
text: '%s%d°'.format(tempPrefix, Math.round(tempValue)),
|
||||
x_align: Clutter.ActorAlign.CENTER,
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue