[Koha-cvs] CVS: koha/C4 Date.pm,1.10,1.11

Mike Hansen wolfpac444 at users.sourceforge.net
Thu Apr 3 03:28:30 CEST 2003


Update of /cvsroot/koha/koha/C4
In directory sc8-pr-cvs1:/tmp/cvs-serv6047/koha/C4

Modified Files:
	Date.pm 
Log Message:
Added Paul's changes to the version that should be current.  I have been having problems with my version reverting back to an old 
one.


Index: Date.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Date.pm,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -r1.10 -r1.11
*** Date.pm	1 Apr 2003 12:26:02 -0000	1.10
--- Date.pm	3 Apr 2003 01:28:28 -0000	1.11
***************
*** 18,25 ****
               &display_date_format
               &format_date
  );
  
  
- 
  sub get_date_format
  {
--- 18,25 ----
               &display_date_format
               &format_date
+              &format_date_in_iso
  );
  
  
  sub get_date_format
  {
***************
*** 32,36 ****
  {
  	my $dateformat = get_date_format();
! 
  	if ( $dateformat eq "us" )
  	{
--- 32,36 ----
  {
  	my $dateformat = get_date_format();
! 	
  	if ( $dateformat eq "us" )
  	{
***************
*** 61,64 ****
--- 61,65 ----
  	if ( $dateformat eq "us" )
  	{
+ 		Date_Init("DateFormat=US");
  		$olddate = ParseDate($olddate);
  		$newdate = UnixDate($olddate,'%m/%d/%Y');
***************
*** 66,69 ****
--- 67,71 ----
  	elsif ( $dateformat eq "metric" )
  	{
+ 		Date_Init("DateFormat=metric");
  		$olddate = ParseDate($olddate);
  		$newdate = UnixDate($olddate,'%d/%m/%Y');
***************
*** 71,74 ****
--- 73,77 ----
  	elsif ( $dateformat eq "iso" )
  	{
+ 		Date_Init("DateFormat=iso");
  		$olddate = ParseDate($olddate);
  		$newdate = UnixDate($olddate,'%Y-%m-%d');
***************
*** 80,82 ****
--- 83,116 ----
  }
  
+ sub format_date_in_iso
+ {
+         my $olddate = shift;
+         my $newdate;
+                 
+         my $dateformat = get_date_format();
+ 
+         if ( $dateformat eq "us" )
+         {
+                 Date_Init("DateFormat=US");
+                 $olddate = ParseDate($olddate);
+         }
+         elsif ( $dateformat eq "metric" )
+         {
+                 Date_Init("DateFormat=metric");
+                 $olddate = ParseDate($olddate);
+         }
+         elsif ( $dateformat eq "iso" )
+         {
+                 Date_Init("DateFormat=iso");
+                 $olddate = ParseDate($olddate);
+         }
+         else
+         {
+                 return "9999-99-99";
+         }
+ 
+ 	$newdate = UnixDate($olddate, '%Y-%m-%d');
+ 
+ 	return $newdate;
+ }
  1;





More information about the Koha-cvs mailing list