[Rt-commit] rt branch, 4.2/ical-date-only-timezone, created. rt-4.0.0rc6-153-g89a48e0

Ruslan Zakirov ruz at bestpractical.com
Sat Mar 5 01:05:51 EST 2011


The branch, 4.2/ical-date-only-timezone has been created
        at  89a48e0ea6a1e758a84aaf87bb008de5d0c17ffc (commit)

- Log -----------------------------------------------------------------
commit 89a48e0ea6a1e758a84aaf87bb008de5d0c17ffc
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Mar 5 09:00:13 2011 +0300

    dates in iCal can suffer from conversion to UTC
    
    date only fields in iCal has no timezone information
    and it's more correct to present date in user's timezone
    rather then in UTC where it get +1 or -1 day hit

diff --git a/lib/RT/Date.pm b/lib/RT/Date.pm
index ceb1c21..5cabd63 100644
--- a/lib/RT/Date.pm
+++ b/lib/RT/Date.pm
@@ -866,7 +866,9 @@ sub RFC2616 {
 
 =head4 iCal
 
-Returns the object's date and time in iCalendar format,
+Returns the object's date and time in iCalendar format.
+If only date requested then users timezone is used, otherwise
+it's UTC.
 
 Supports arguments: C<Date> and C<Time>.
 See </Output formatters> for description of arguments.
@@ -879,8 +881,16 @@ sub iCal {
         Date => 1, Time => 1,
         @_,
     );
+
+    my $tz;
+    if ( $args{'Date'} && !$args{'Time'} ) {
+        $tz = 'user';
+    } else {
+        $tz = 'utc';
+    }
+
     my ($sec,$min,$hour,$mday,$mon,$year,$wday,$ydaym,$isdst,$offset) =
-        $self->Localtime( 'utc' );
+        $self->Localtime( $tz );
 
     #the month needs incrementing, as gmtime returns 0-11
     $mon++;

-----------------------------------------------------------------------


More information about the Rt-commit mailing list