[rt-users] Query by age
Phil Homewood
pdh at snapgear.com
Wed Dec 18 21:02:43 EST 2002
Phil Homewood wrote:
> Looked at it but it didn't seem to be such a clean drop-in
> replacement. Time::ParseDate does. Working on it now.
Following trivial patch makes RT::Date use Time::ParseDate.
The args to Time::ParseDate::parsedate should probably be
pulled out into config.pm variables, but aside from that,
it seems to work just fine here.
--
Phil Homewood, Systems Janitor, www.SnapGear.com
pdh at snapgear.com Ph: +61 7 3435 2810 Fx: +61 7 3891 3630
SnapGear - Custom Embedded Solutions and Security Appliances
-------------- next part --------------
Index: bin/mason_handler.fcgi
===================================================================
RCS file: /cvs/local/rt/bin/mason_handler.fcgi,v
retrieving revision 1.2
diff -u -r1.2 mason_handler.fcgi
--- bin/mason_handler.fcgi 29 Nov 2002 05:10:57 -0000 1.2
+++ bin/mason_handler.fcgi 19 Dec 2002 01:51:35 -0000
@@ -76,7 +76,7 @@
use RT::Interface::Web;
use MIME::Entity;
use CGI::Cookie;
- use Date::Parse;
+ use Time::ParseDate;
use HTML::Entities;
use Text::Wrapper;
Index: bin/mason_handler.scgi
===================================================================
RCS file: /cvs/local/rt/bin/mason_handler.scgi,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 mason_handler.scgi
--- bin/mason_handler.scgi 22 Jan 2002 23:47:43 -0000 1.1.1.2
+++ bin/mason_handler.scgi 19 Dec 2002 01:51:05 -0000
@@ -88,7 +88,7 @@
use RT::Interface::Web;
use MIME::Entity;
use CGI::Cookie;
- use Date::Parse;
+ use Time::ParseDate;
use HTML::Entities;
Index: bin/webmux.pl
===================================================================
RCS file: /cvs/local/rt/bin/webmux.pl,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 webmux.pl
--- bin/webmux.pl 15 Jul 2002 01:25:45 -0000 1.1.1.3
+++ bin/webmux.pl 19 Dec 2002 01:51:13 -0000
@@ -78,7 +78,7 @@
use MIME::Entity;
use Text::Wrapper;
use Apache::Cookie;
- use Date::Parse;
+ use Time::ParseDate;
use HTML::Entities;
#TODO: make this use DBI
Index: lib/Makefile.PL
===================================================================
RCS file: /cvs/local/rt/lib/Makefile.PL,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 Makefile.PL
--- lib/Makefile.PL 22 Jan 2002 23:47:43 -0000 1.1.1.3
+++ lib/Makefile.PL 19 Dec 2002 01:55:33 -0000
@@ -7,8 +7,7 @@
'PREREQ_PM' => {
'DBI' => 1.16,
'DBIx::SearchBuilder' => '0.48',
- 'Date::Parse' => 0,
- 'Date::Format' => 0,
+ 'Time::ParseDate' => 0,
'MIME::Entity' => 5.108,
'Mail::Mailer' => '1.20',
'Log::Dispatch' => 1.6,
Index: lib/RT/Date.pm
===================================================================
RCS file: /cvs/local/rt/lib/RT/Date.pm,v
retrieving revision 1.2
diff -u -r1.2 Date.pm
--- lib/RT/Date.pm 12 Sep 2002 23:41:49 -0000 1.2
+++ lib/RT/Date.pm 19 Dec 2002 01:52:26 -0000
@@ -61,10 +61,10 @@
If $args->{'Format'} is ISO, tries to parse an ISO date.
-If $args->{'Format'} is 'unknown', require Date::Parse and make it figure things
-out. This is a heavyweight operation that should never be called from within
-RT's core. But it's really useful for something like the textbox date entry
-where we let the user do whatever they want.
+If $args->{'Format'} is 'unknown', require Time::ParseDate and make it figure
+things out. This is a heavyweight operation that should never be called from
+within RT's core. But it's really useful for something like the textbox date
+entry where we let the user do whatever they want.
If $args->{'Value'} is 0, assumes you mean never.
@@ -128,15 +128,16 @@
}
}
elsif ($args{'Format'} =~ /^unknown$/i) {
- require Date::Parse;
+ require Time::ParseDate;
#Convert it to an ISO format string
- my $date = Date::Parse::str2time($args{'Value'});
+ my $date = Time::ParseDate::parsedate($args{'Value'},
+ UK => 1, PREFER_PAST => 1);
#This date has now been set to a date in the _local_ timezone.
#since ISO dates are known to be in GMT (for RT's purposes);
- $RT::Logger->debug("RT::Date used date::parse to make ".$args{'Value'} . " $date\n");
+ $RT::Logger->debug("RT::Date used Time::ParseDate to make ".$args{'Value'} . " $date\n");
return ($self->Set( Format => 'unix', Value => "$date"));
Index: tools/testdeps
===================================================================
RCS file: /cvs/local/rt/tools/testdeps,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 testdeps
--- tools/testdeps 15 Jul 2002 01:25:46 -0000 1.1.1.4
+++ tools/testdeps 19 Dec 2002 01:52:54 -0000
@@ -33,7 +33,7 @@
CGI::Cookie 1.20
Apache::Cookie
Apache::Session 1.53
-Date::Parse
+Time::ParseDate
Date::Format
MIME::Entity 5.108
Mail::Mailer 1.20
More information about the rt-users
mailing list