dateMenu: Limit timezone offset hours to integers

If the timezone offset calculation in the World Clocks contains non-zero
minutes, then a decimal Hours value is being displayed. Limit the Hours value
to integers by using Math.floor().

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2255>
This commit is contained in:
Raghuveer Kasaraneni 2022-03-21 19:24:25 +01:00 committed by Marge Bot
parent 19dc551771
commit 0e45273330

View File

@ -467,7 +467,8 @@ class WorldClocksSection extends St.Button {
const localOffset = GLib.DateTime.new_now_local().get_utc_offset();
const utcOffset = GLib.DateTime.new_now(tz).get_utc_offset();
const offsetCurrentTz = utcOffset - localOffset;
const offsetHours = Math.abs(offsetCurrentTz) / GLib.TIME_SPAN_HOUR;
const offsetHours =
Math.floor(Math.abs(offsetCurrentTz) / GLib.TIME_SPAN_HOUR);
const offsetMinutes =
(Math.abs(offsetCurrentTz) % GLib.TIME_SPAN_HOUR) /
GLib.TIME_SPAN_MINUTE;