Fixed problems with non-US date such as 28/10/1983.

This commit is contained in:
wolfpac444 2003-03-26 03:46:20 +00:00
parent 398a4d5242
commit 28be0337c5
2 changed files with 9 additions and 6 deletions

View File

@ -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');
}

View File

@ -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'}."<br>".$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,