[freeside-commits] freeside/rt/lib/RT Date.pm, 1.1.1.9.4.2, 1.1.1.9.4.3 Tickets_Overlay.pm, 1.5.2.7, 1.5.2.8
Mark Wells
mark at wavetail.420.am
Thu Apr 14 21:01:30 PDT 2011
Update of /home/cvs/cvsroot/freeside/rt/lib/RT
In directory wavetail.420.am:/tmp/cvs-serv20264/lib/RT
Modified Files:
Tag: FREESIDE_2_1_BRANCH
Date.pm Tickets_Overlay.pm
Log Message:
Timezone issues with this-month search, #11057
Index: Date.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Date.pm,v
retrieving revision 1.1.1.9.4.2
retrieving revision 1.1.1.9.4.3
diff -u -w -d -r1.1.1.9.4.2 -r1.1.1.9.4.3
--- Date.pm 8 Apr 2011 23:13:49 -0000 1.1.1.9.4.2
+++ Date.pm 15 Apr 2011 04:01:27 -0000 1.1.1.9.4.3
@@ -286,6 +286,8 @@
my %args = @_;
my $tz = $args{'Timezone'} || '';
my @localtime = $self->Localtime($tz);
+ #remove 'offset' so that DST is figured based on the resulting time.
+ pop @localtime;
# This is the cleanest way to implement it, I swear.
{
@@ -520,15 +522,20 @@
=cut
sub AddMonth {
- require Time::ParseDate;
my $self = shift;
- my $date = (
- Time::ParseDate::parsedate(
- '1 month',
- NOW => $self->Unix
- )
- );
- return $self->Unix($date);
+ my %args = @_;
+ my @localtime = $self->Localtime($args{'Timezone'});
+ # remove offset, as with SetToStart
+ pop @localtime;
+
+ $localtime[4]++; #month
+ if ( $localtime[4] == 12 ) {
+ $localtime[4] = 0;
+ $localtime[5]++; #year
+ }
+
+ my $new = $self->Timelocal($args{'Timezone'}, @localtime);
+ return $self->Unix($new);
}
=head2 Unix [unixtime]
Index: Tickets_Overlay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/rt/lib/RT/Tickets_Overlay.pm,v
retrieving revision 1.5.2.7
retrieving revision 1.5.2.8
diff -u -w -d -r1.5.2.7 -r1.5.2.8
--- Tickets_Overlay.pm 8 Apr 2011 23:13:49 -0000 1.5.2.7
+++ Tickets_Overlay.pm 15 Apr 2011 04:01:27 -0000 1.5.2.8
@@ -548,7 +548,7 @@
$date->SetToNow;
$date->SetToStart('month', Timezone => 'server');
$daystart = $date->ISO;
- $date->AddMonth;
+ $date->AddMonth(Timezone => 'server');
$dayend = $date->ISO;
}
elsif ( lc($value) eq 'last month' ) {
More information about the freeside-commits
mailing list