[Jifty-commit] r6537 - in jifty/trunk: lib/Jifty

Jifty commits jifty-commit at lists.jifty.org
Mon Mar 2 20:11:23 EST 2009


Author: sartak
Date: Mon Mar  2 20:11:23 2009
New Revision: 6537

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/DateTime.pm

Log:
 r80776 at onn:  sartak | 2009-03-02 20:11:16 -0500
 Some cleanups and better comments


Modified: jifty/trunk/lib/Jifty/DateTime.pm
==============================================================================
--- jifty/trunk/lib/Jifty/DateTime.pm	(original)
+++ jifty/trunk/lib/Jifty/DateTime.pm	Mon Mar  2 20:11:23 2009
@@ -56,12 +56,12 @@
 
 sub new {
     my $class = shift;
-    my %args  = (@_);
+    my %args  = @_;
 
     my $replace_tz = delete $args{_replace_time_zone};
     my $current_user = delete $args{current_user};
 
-    my $self  = $class->SUPER::new(%args);
+    my $self = $class->SUPER::new(%args);
 
     $self->current_user($current_user) if $current_user;
 
@@ -80,7 +80,8 @@
         # $args{time_zone}, then DateTime::from_epoch will get very confused
         if (!$args{time_zone} || $replace_tz) {
             if (my $tz = $self->current_user_has_timezone) {
-                # XXX: we do this because of the floating timezone
+                # if we just set $tz directly, then it won't convert properly
+                # from the Floating time zone.
                 $self->set_time_zone("UTC");
 
                 $self->set_time_zone( $tz );
@@ -289,7 +290,7 @@
     if ($ymd eq $tomorrow->ymd) {
         return "tomorrow";
     }
-    
+
     # None of the above, just spit out the date
     return $ymd;
 }
@@ -343,9 +344,7 @@
     my $dt = shift;
 
     # if it looks like just a date, then return just the date portion
-    return $dt->ymd
-        if lc($dt->time_zone->name) eq 'floating'
-        && $dt->hms('') eq '000000';
+    return $dt->ymd if $dt->is_date;
 
     # otherwise let stringification take care of it
     return $dt;


More information about the Jifty-commit mailing list