projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2b13f96
)
Timezone issues with this-month search, #11057
author
mark
<mark>
Fri, 15 Apr 2011 04:01:17 +0000
(
04:01
+0000)
committer
mark
<mark>
Fri, 15 Apr 2011 04:01:17 +0000
(
04:01
+0000)
rt/lib/RT/Date.pm
patch
|
blob
|
history
rt/lib/RT/Tickets_Overlay.pm
patch
|
blob
|
history
diff --git
a/rt/lib/RT/Date.pm
b/rt/lib/RT/Date.pm
index
cc66e0f
..
e68526c
100644
(file)
--- a/
rt/lib/RT/Date.pm
+++ b/
rt/lib/RT/Date.pm
@@
-286,6
+286,8
@@
sub SetToStart {
my %args = @_;
my $tz = $args{'Timezone'} || '';
my @localtime = $self->Localtime($tz);
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.
{
# This is the cleanest way to implement it, I swear.
{
@@
-519,16
+521,21
@@
unix time.
=cut
=cut
-sub AddMonth {
- require Time::ParseDate;
+sub AddMonth {
my $self = shift;
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]
}
=head2 Unix [unixtime]
diff --git
a/rt/lib/RT/Tickets_Overlay.pm
b/rt/lib/RT/Tickets_Overlay.pm
index
5a7e020
..
ffbbc85
100644
(file)
--- a/
rt/lib/RT/Tickets_Overlay.pm
+++ b/
rt/lib/RT/Tickets_Overlay.pm
@@
-548,7
+548,7
@@
sub _DateFieldLimit {
$date->SetToNow;
$date->SetToStart('month', Timezone => 'server');
$daystart = $date->ISO;
$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' ) {
$dayend = $date->ISO;
}
elsif ( lc($value) eq 'last month' ) {