[Rt-commit] rt branch, 4.2/parse-relative-date-time-timezones, created. rt-4.0.6-335-gbfaf948

Ruslan Zakirov ruz at bestpractical.com
Sun Jun 10 07:49:00 EDT 2012


The branch, 4.2/parse-relative-date-time-timezones has been created
        at  bfaf9488468b66e22562311bf745dca98ab64d02 (commit)

- Log -----------------------------------------------------------------
commit bfaf9488468b66e22562311bf745dca98ab64d02
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sun Jun 10 15:44:01 2012 +0400

    try to use ZONE argument in Time::ParseDate
    
    We have problems with parsing 'tommorow 10pm'. We should
    try to use ZONE argument instead of compensating difference.

diff --git a/lib/RT/Date.pm b/lib/RT/Date.pm
index ed094d0..daae652 100644
--- a/lib/RT/Date.pm
+++ b/lib/RT/Date.pm
@@ -203,21 +203,13 @@ sub Set {
     }
     elsif ( $args{'Format'} =~ /^unknown$/i ) {
         require Time::ParseDate;
-        # the module supports only legacy timezones like PDT or EST...
-        # so we parse date as GMT and later apply offset, this only
-        # should be applied to absolute times, so compensate shift in NOW
-        my $now = time;
-        $now += ($self->Localtime( $args{Timezone}, $now ))[9];
         my $date = Time::ParseDate::parsedate(
             $args{'Value'},
-            GMT           => 1,
-            NOW           => $now,
+            GMT           => $self->Timezone($args{'Timezone'}),
             UK            => RT->Config->Get('DateDayBeforeMonth'),
             PREFER_PAST   => RT->Config->Get('AmbiguousDayInPast'),
             PREFER_FUTURE => RT->Config->Get('AmbiguousDayInFuture'),
         );
-        # apply timezone offset
-        $date -= ($self->Localtime( $args{Timezone}, $date ))[9];
 
         $RT::Logger->debug(
             "RT::Date used Time::ParseDate to make '$args{'Value'}' $date\n"

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


More information about the Rt-commit mailing list