[Rt-commit] rt branch, 4.0/date-formats-in-user-tz, created. rt-4.0.7-54-g14b8c0b

Thomas Sibley trs at bestpractical.com
Wed Aug 29 17:11:48 EDT 2012


The branch, 4.0/date-formats-in-user-tz has been created
        at  14b8c0b7db7632012d3a4e991b6b3b059539eb02 (commit)

- Log -----------------------------------------------------------------
commit 14b8c0b7db7632012d3a4e991b6b3b059539eb02
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Aug 29 14:01:55 2012 -0700

    Display date format options in the user's timezone
    
    It is now obvious from the formats which ones are defined as always
    being in UTC vs. the ones which happened to be displayed that way in
    preferences.  See [rt3 #20856] for an example of confusion caused by all
    UTC datetimes.
    
    Despite no user visible change, switch from ->Set to ->SetToNow because
    the effect is much more clear when reading the code.

diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index ba338bb..04c817f 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -435,10 +435,13 @@ our %META = (
             Description => 'Date format',                            #loc
             Callback => sub { my $ret = { Values => [], ValuesLabel => {}};
                               my $date = RT::Date->new($HTML::Mason::Commands::session{'CurrentUser'});
-                              $date->Set;
+                              $date->SetToNow;
                               foreach my $value ($date->Formatters) {
                                  push @{$ret->{Values}}, $value;
-                                 $ret->{ValuesLabel}{$value} = $date->$value();
+                                 $ret->{ValuesLabel}{$value} = $date->Get(
+                                     Format     => $value,
+                                     Timezone   => 'user',
+                                 );
                               }
                               return $ret;
             },

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


More information about the Rt-commit mailing list