[interchange-cvs] interchange - racke modified
code/Filter/date_change.filter
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Mon Jun 19 16:21:33 EDT 2006
User: racke
Date: 2006-06-19 20:21:33 GMT
Modified: code/Filter date_change.filter
Log:
avoid ambiguity between two time formats
Revision Changes Path
1.7 +8 -6 interchange/code/Filter/date_change.filter
rev 1.7, prev_rev 1.6
Index: date_change.filter
===================================================================
RCS file: /var/cvs/interchange/code/Filter/date_change.filter,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- date_change.filter 11 Apr 2006 16:33:01 -0000 1.6
+++ date_change.filter 19 Jun 2006 20:21:33 -0000 1.7
@@ -1,7 +1,7 @@
# Copyright 2002-2006 Interchange Development Group (http://www.icdevgroup.org/)
# Copyright 1996-2002 Red Hat, Inc.
# Licensed under the GNU GPL v2. See file LICENSE for details.
-# $Id: date_change.filter,v 1.6 2006/04/11 16:33:01 racke Exp $
+# $Id: date_change.filter,v 1.7 2006/06/19 20:21:33 racke Exp $
CodeDef date_change Filter
CodeDef date_change Description Date widget
@@ -14,12 +14,12 @@
HTML::Entities::decode_entities($val) if $val =~ /&/;
$val =~ s/\0+//g;
my $re = $opt->{undef}
- ? qr:(\d*)[-/]+(\d*)[-/]+(\d*):
- : qr:(\d+)[-/]+(\d+)[-/]+(\d+):
+ ? qr:^(\d*)[-/]+(\d*)[-/]+(\d*)(.*)$:
+ : qr:^(\d+)[-/]+(\d+)[-/]+(\d+)(.*)$:
;
return $val unless $val =~ /$re/;
- my ($year, $month, $day);
+ my ($year, $month, $day, $timeval);
if (length($1) == 4) {
# ISO date style 2003-03-20
@@ -30,6 +30,8 @@
($year, $month, $day) = ($3, $1, $2);
}
+ $timeval = $4;
+
if ($opt->{undef}) {
# return nothing (undef, which DBI treats as SQL NULL) for an
# empty date (all zeroes or nothing at all)
@@ -52,7 +54,7 @@
}
my $time;
- if ($val =~ /:(\d{1,4})\s*$/) {
+ if ($timeval =~ /^:(\d{1,4})\s*$/) {
# accept traditional Interchange date_time widget times
# of format '0130', e.g. '20080201:0130'
$time = sprintf('%04d', $1);
@@ -63,7 +65,7 @@
# to support PostgreSQL's timestamp with time zone format
# e.g. '2008-02-01 01:30:05-07'
my ($hours, $minutes, $seconds)
- = ($val =~ /\s(\d\d?):(\d\d?)(?::(\d\d+))/)
+ = ($timeval =~ /\s(\d\d?):(\d\d?)(?::(\d\d+))/)
) {
$time = sprintf($time_format, $hours, $minutes, $seconds);
}
More information about the interchange-cvs
mailing list