[freeside-commits] freeside/rt/lib/RT Date.pm, 1.4, 1.5 Tickets_Overlay.pm, 1.12, 1.13
Mark Wells
mark at wavetail.420.am
Thu Apr 14 21:01:19 PDT 2011
Update of /home/cvs/cvsroot/freeside/rt/lib/RT
In directory wavetail.420.am:/tmp/cvs-serv20212/lib/RT
Modified Files:
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.4
retrieving revision 1.5
diff -u -w -d -r1.4 -r1.5
--- Date.pm 17 Feb 2011 00:52:25 -0000 1.4
+++ Date.pm 15 Apr 2011 04:01:16 -0000 1.5
@@ -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.12
retrieving revision 1.13
diff -u -w -d -r1.12 -r1.13
--- Tickets_Overlay.pm 8 Apr 2011 00:26:59 -0000 1.12
+++ Tickets_Overlay.pm 15 Apr 2011 04:01:17 -0000 1.13
@@ -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