[california] Correctly determine date of event start/end in Week view: Bug #739250



commit 13b503c418ef1a5a7954ab29a71e12fd697e2324
Author: Jim Nelson <jim yorba org>
Date:   Wed Oct 29 14:30:06 2014 -0700

    Correctly determine date of event start/end in Week view: Bug #739250
    
    Week view changes to stack events didn't convert event start/end times
    to local timezone when comparing dates, causing issue with events
    stored in UTC (or other non-local timezones) that straddled midnight.

 src/calendar/calendar-exact-time-span.vala |    7 +++++++
 src/calendar/calendar-exact-time.vala      |    7 +++++++
 src/view/week/week-day-pane.vala           |    4 ++--
 3 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/src/calendar/calendar-exact-time-span.vala b/src/calendar/calendar-exact-time-span.vala
index 355bb8a..20ba263 100644
--- a/src/calendar/calendar-exact-time-span.vala
+++ b/src/calendar/calendar-exact-time-span.vala
@@ -100,6 +100,13 @@ public class ExactTimeSpan : BaseObject, Gee.Comparable<ExactTimeSpan>, Gee.Hash
     }
     
     /**
+     * Same as { link to_timezone} with { link System.timezone} passed as the { link Timezone}.
+     */
+    public ExactTimeSpan to_local() {
+        return to_timezone(System.timezone);
+    }
+    
+    /**
      * Returns true if the { link ExactTime} is in this { link ExactTimeSpan}.
      */
     public bool contains(ExactTime exact_time) {
diff --git a/src/calendar/calendar-exact-time.vala b/src/calendar/calendar-exact-time.vala
index d508dae..869d2a0 100644
--- a/src/calendar/calendar-exact-time.vala
+++ b/src/calendar/calendar-exact-time.vala
@@ -197,6 +197,13 @@ public class ExactTime : BaseObject, Gee.Comparable<ExactTime>, Gee.Hashable<Exa
     }
     
     /**
+     * Same as { link to_timezone} with { link System.timezone} passed as the { link Timezone}.
+     */
+    public ExactTime to_local() {
+        return to_timezone(System.timezone);
+    }
+    
+    /**
      * Returns the { link WallTime} for the { link ExactTime}.
      */
     public WallTime to_wall_time() {
diff --git a/src/view/week/week-day-pane.vala b/src/view/week/week-day-pane.vala
index 89b6b74..d84cb75 100644
--- a/src/view/week/week-day-pane.vala
+++ b/src/view/week/week-day-pane.vala
@@ -335,7 +335,7 @@ internal class DayPane : Pane, Common.InstanceContainer {
                 Calendar.WallTime actual_start_time =
                     
event.exact_time_span.start_exact_time.to_timezone(Calendar.Timezone.local).to_wall_time();
                 Calendar.WallTime draw_start_time;
-                if (event.exact_time_span.start_date.equal_to(date))
+                if (event.exact_time_span.to_local().start_date.equal_to(date))
                     draw_start_time = actual_start_time;
                 else
                     draw_start_time = Calendar.WallTime.earliest;
@@ -343,7 +343,7 @@ internal class DayPane : Pane, Common.InstanceContainer {
                 Calendar.WallTime actual_end_time =
                     event.exact_time_span.end_exact_time.to_timezone(Calendar.Timezone.local).to_wall_time();
                 Calendar.WallTime draw_end_time;
-                if (event.exact_time_span.end_date.equal_to(date))
+                if (event.exact_time_span.to_local().end_date.equal_to(date))
                     draw_end_time = actual_end_time;
                 else
                     draw_end_time = Calendar.WallTime.latest;


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