From 659ac95c142120f54152f9e80840dd322f424dde Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 23 Sep 2005 15:53:33 +0000 Subject: [PATCH] fixing up the date scrubber git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@540 9efc2488-bf62-4759-914b-345cdb29e865 --- src/perlmods/OpenSRF/Utils.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/perlmods/OpenSRF/Utils.pm b/src/perlmods/OpenSRF/Utils.pm index af9e3b9..a84d130 100644 --- a/src/perlmods/OpenSRF/Utils.pm +++ b/src/perlmods/OpenSRF/Utils.pm @@ -241,13 +241,13 @@ sub interval_to_seconds { $interval =~ s/,/ /g; my $amount = 0; - while ($interval =~ /\s*\+?\s*(\d+)\s*(\w{1})\w*\s*/g) { - $amount += $1 if ($2 eq 's'); - $amount += 60 * $1 if ($2 eq 'm'); - $amount += 60 * 60 * $1 if ($2 eq 'h'); - $amount += 60 * 60 * 24 * $1 if ($2 eq 'd'); - $amount += 60 * 60 * 24 * 7 * $1 if ($2 eq 'w'); - $amount += ((60 * 60 * 24 * 365)/12) * $1 if ($2 eq 'M'); + while ($interval =~ /\s*\+?\s*(\d+)\s*((\w{1})\w*)\s*/g) { + $amount += $1 if ($3 eq 's'); + $amount += 60 * $1 if ($3 eq 'm' || $2 =~ /^mi/io); + $amount += 60 * 60 * $1 if ($3 eq 'h'); + $amount += 60 * 60 * 24 * $1 if ($3 eq 'd'); + $amount += 60 * 60 * 24 * 7 * $1 if ($3 eq 'w'); + $amount += ((60 * 60 * 24 * 365)/12) * $1 if ($3 eq 'M' || $2 =~ /^mo/io); $amount += 60 * 60 * 24 * 365 * $1 if ($2 eq 'y'); } return $amount; @@ -341,7 +341,7 @@ sub set_psname { sub clense_ISO8601 { my $self = shift; my $date = shift || $self; - if ($date =~ /(\d{4})-?(\d{2})-?(\d{2}).?(\d{2}):(\d{2}):(\d{2})\.?\d*((?:-|\+)[0-9:]{2,5})?$/) { + if ($date =~ /^\s*(\d{4})-?(\d{2})-?(\d{2}).?(\d{2}):(\d{2}):(\d{2})\.?\d*((?:-|\+)[0-9:]{2,5})?\s*$/o) { my $z = $7 || '+00:00'; if (length($z) > 3 && $z !~ /:/o) { substr($z,3,0,':'); -- 2.11.0