Commit 5a2b0dfc authored by Paolo Borelli's avatar Paolo Borelli

Sunrise and sunset should be shown in the time local to the city

This has also the side effect of properly showing those times in RTL
locales and respecting AM/PM since we now take care of the formatting.
parent 8da88c8b
......@@ -67,13 +67,25 @@ private class Item : Object, ContentItem {
public string sunrise_label {
owned get {
return weather_info.get_sunrise ();
ulong sunrise;
if (!weather_info.get_value_sunrise (out sunrise)) {
return "-";
}
var sunrise_time = new GLib.DateTime.from_unix_local (sunrise);
sunrise_time = sunrise_time.to_timezone (time_zone);
return Utils.WallClock.get_default ().format_time (sunrise_time);
}
}
public string sunset_label {
owned get {
return weather_info.get_sunset ();
ulong sunset;
if (!weather_info.get_value_sunset (out sunset)) {
return "-";
}
var sunset_time = new GLib.DateTime.from_unix_local (sunset);
sunset_time = sunset_time.to_timezone (time_zone);
return Utils.WallClock.get_default ().format_time (sunset_time);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment