diff options
author | mark <mark> | 2011-01-31 23:58:59 +0000 |
---|---|---|
committer | mark <mark> | 2011-01-31 23:58:59 +0000 |
commit | bbc01a8ab62529c2eb926bd586ba6b1af3147f8b (patch) | |
tree | ff5908b003a25679dabe118833d612b9c63abbe0 /rt/lib/RT | |
parent | 74b0a0190e99064a501f7168b0a00af1d9da380b (diff) |
search for 'last month', RT#11057
Diffstat (limited to 'rt/lib/RT')
-rw-r--r-- | rt/lib/RT/Tickets_Overlay.pm | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/rt/lib/RT/Tickets_Overlay.pm b/rt/lib/RT/Tickets_Overlay.pm index e3658fee6..16e98aec8 100644 --- a/rt/lib/RT/Tickets_Overlay.pm +++ b/rt/lib/RT/Tickets_Overlay.pm @@ -539,16 +539,26 @@ sub _DateFieldLimit { # if we're specifying =, that means we want everything on a # particular single day. in the database, we need to check for > # and < the edges of that day. + # + # Except if the value is 'this month' or 'last month', check + # > and < the edges of the month. my ($daystart, $dayend); if ( lc($value) eq 'this month' ) { - # special case: > and < the edges of this month $date->SetToNow; - $date->SetToStart('month'); + $date->SetToStart('month', Timezone => 'server'); $daystart = $date->ISO; $date->AddMonth; $dayend = $date->ISO; } + elsif ( lc($value) eq 'last month' ) { + $date->SetToNow; + $date->SetToStart('month', Timezone => 'server'); + $dayend = $date->ISO; + $date->AddDays(-1); + $date->SetToStart('month', Timezone => 'server'); + $daystart = $date->ISO; + } else { $date->SetToMidnight( Timezone => 'server' ); $daystart = $date->ISO; |