[geary/wip/fix-date-handling: 59/60] Ensure email dates are displayed to in the local time zone



commit 0899fb266c93978d0ce839bf8219146a46ac26d5
Author: Michael Gratton <mike vee net>
Date:   Wed Mar 13 16:56:14 2019 +1100

    Ensure email dates are displayed to in the local time zone

 src/client/conversation-list/formatted-conversation-data.vala | 6 ++++--
 src/client/conversation-viewer/conversation-email.vala        | 7 ++++++-
 src/client/conversation-viewer/conversation-message.vala      | 5 +++--
 3 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/client/conversation-list/formatted-conversation-data.vala 
b/src/client/conversation-list/formatted-conversation-data.vala
index cbb126b6..93fb7f6d 100644
--- a/src/client/conversation-list/formatted-conversation-data.vala
+++ b/src/client/conversation-list/formatted-conversation-data.vala
@@ -129,8 +129,10 @@ public class FormattedConversationData : Geary.BaseObject {
 
         // conversation list store sorts by date-received, so display that instead of sender's
         // Date:
-        string new_date = Date.pretty_print(latest.properties.date_received,
-            GearyApplication.instance.config.clock_format);
+        string new_date = Date.pretty_print(
+            latest.properties.date_received.to_local(),
+            GearyApplication.instance.config.clock_format
+        );
         if (new_date == date)
             return false;
 
diff --git a/src/client/conversation-viewer/conversation-email.vala 
b/src/client/conversation-viewer/conversation-email.vala
index ea57e20e..318920cb 100644
--- a/src/client/conversation-viewer/conversation-email.vala
+++ b/src/client/conversation-viewer/conversation-email.vala
@@ -994,7 +994,12 @@ public class ConversationEmail : Gtk.Box, Geary.BaseInterface {
         if (this.email.date != null) {
             // Translators: Human-readable version of the RFC 822 Date header
             builder.set_member_name(_("Date:"));
-            builder.add_string_value(this.email.date.to_string());
+            builder.add_string_value(
+                Date.pretty_print_verbose(
+                    this.email.date.value.to_local(),
+                    this.config.clock_format
+                )
+            );
         }
         if (this.email.subject != null) {
             // Translators: Human-readable version of the RFC 822 Subject header
diff --git a/src/client/conversation-viewer/conversation-message.vala 
b/src/client/conversation-viewer/conversation-message.vala
index e8cd4f27..6e8dad28 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -399,11 +399,12 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
         string date_text = "";
         string date_tooltip = "";
         if (date != null) {
+            GLib.DateTime local_date = date.value.to_local();
             date_text = Date.pretty_print(
-                date.value, config.clock_format
+                local_date, config.clock_format
             );
             date_tooltip = Date.pretty_print_verbose(
-                date.value, config.clock_format
+                local_date, config.clock_format
             );
         }
         this.compact_date.set_text(date_text);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]