From 28be0337c51ab245a2d75c3afde8fa3d2a526366 Mon Sep 17 00:00:00 2001 From: wolfpac444 Date: Wed, 26 Mar 2003 03:46:20 +0000 Subject: [PATCH] Fixed problems with non-US date such as 28/10/1983. --- C4/Date.pm | 3 +++ newmember.pl | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/C4/Date.pm b/C4/Date.pm index 5e3a6cfdd6..c06ea5f490 100644 --- a/C4/Date.pm +++ b/C4/Date.pm @@ -68,16 +68,19 @@ sub format_date if ( $dateformat eq "us" ) { + Date_Init("DateFormat=US"); $olddate = ParseDate($olddate); $newdate = UnixDate($olddate,'%m/%d/%Y'); } elsif ( $dateformat eq "metric" ) { + Date_Init("DateFormat=metric"); $olddate = ParseDate($olddate); $newdate = UnixDate($olddate,'%d/%m/%Y'); } elsif ( $dateformat eq "iso" ) { + Date_Init("DateFormat=iso"); $olddate = ParseDate($olddate); $newdate = UnixDate($olddate,'%Y-%m-%d'); } diff --git a/newmember.pl b/newmember.pl index 5d1bee5fcf..3c4092da1f 100755 --- a/newmember.pl +++ b/newmember.pl @@ -42,7 +42,7 @@ use C4::Interface::CGI::Output; use CGI; use Date::Manip; use HTML::Template; - +use C4::Date; my %env; my $input = new CGI; @@ -126,11 +126,11 @@ if ($ok == 0) { } if ($data{'joining'} eq ''){ $data{'joining'}=ParseDate('today'); - $data{'joining'}=&UnixDate($data{'joining'},'%Y-%m-%d'); + $data{'joining'}=format_date($data{'joining'}); } if ($data{'expiry'} eq ''){ $data{'expiry'}=ParseDate('in 1 year'); - $data{'expiry'}=&UnixDate($data{'expiry'},'%Y-%m-%d'); + $data{'expiry'}=format_date($data{'expiry'}); } my $ethnic=$data{'ethnicity'}." ".$data{'ethnicnotes'}; my $postal=$data{'address'}."
".$data{'city'}; @@ -155,11 +155,11 @@ if ($ok == 0) { memcat => $data{'categorycode'}, area => $data{'area'}, fee => $data{'fee'}, - joindate => $data{'joining'}, - expdate => $data{'expiry'}, + joindate => format_date($data{'joining'}), + expdate => format_date($data{'expiry'}), joinbranch => $data{'joinbranch'}, ethnic => $ethnic, - dob => $data{'dateofbirth'}, + dob => format_date($data{'dateofbirth'}), sex => $sex, postal => $postal, home => $home, -- 2.39.5