aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2023-02-07 20:10:17 +0100
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2023-10-05 14:32:06 +0200
commitfb46755aec1d2c52dcb12bfc9714e26c84ec3d3d (patch)
tree2631b93b75561bdce080cf88d80fe608749a45d8 /main/src
parent84b22752ab8f40cf5014d728788016738debbb27 (diff)
downloaddino-fb46755aec1d2c52dcb12bfc9714e26c84ec3d3d.tar.gz
Fix various date/time stamps not updated or wrong time zone
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/conversation_content_view/call_widget.vala2
-rw-r--r--main/src/ui/conversation_content_view/conversation_item_skeleton.vala13
2 files changed, 7 insertions, 8 deletions
diff --git a/main/src/ui/conversation_content_view/call_widget.vala b/main/src/ui/conversation_content_view/call_widget.vala
index e45792e2..aa648c39 100644
--- a/main/src/ui/conversation_content_view/call_widget.vala
+++ b/main/src/ui/conversation_content_view/call_widget.vala
@@ -170,7 +170,7 @@ namespace Dino.Ui {
case Call.State.ENDED:
image.set_from_icon_name("dino-phone-hangup-symbolic", IconSize.LARGE_TOOLBAR);
title_label.label = _("Call ended");
- string formated_end = Util.format_time(call.end_time, _("%H∶%M"), _("%l∶%M %p"));
+ string formated_end = Util.format_time(call.end_time.to_local(), _("%H∶%M"), _("%l∶%M %p"));
string duration = get_duration_string(call.end_time.difference(call.local_time));
subtitle_label.label = _("Ended at %s").printf(formated_end) +
" · " +
diff --git a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
index 3af482dc..870cf2fb 100644
--- a/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
+++ b/main/src/ui/conversation_content_view/conversation_item_skeleton.vala
@@ -208,7 +208,7 @@ public class ItemMetaDataHeader : Box {
private void update_time() {
time_label.label = get_relative_time(item.time.to_local()).to_string();
- time_update_timeout = Timeout.add_seconds((int) get_next_time_change(), () => {
+ time_update_timeout = Timeout.add_seconds((int) get_next_time_change(item.time), () => {
if (this.parent == null) return false;
update_time();
return false;
@@ -260,16 +260,15 @@ public class ItemMetaDataHeader : Box {
}
}
- private int get_next_time_change() {
+ public static int get_next_time_change(DateTime datetime) {
DateTime now = new DateTime.now_local();
- DateTime item_time = item.time;
- TimeSpan timespan = now.difference(item_time);
+ TimeSpan timespan = now.difference(datetime);
if (timespan < 10 * TimeSpan.MINUTE) {
- if (now.get_second() < item_time.get_second()) {
- return item_time.get_second() - now.get_second();
+ if (now.get_second() < datetime.get_second()) {
+ return datetime.get_second() - now.get_second();
} else {
- return 60 - (now.get_second() - item_time.get_second());
+ return 60 - (now.get_second() - datetime.get_second());
}
} else {
return (23 - now.get_hour()) * 3600 + (59 - now.get_minute()) * 60 + (59 - now.get_second());