File Date-Tiny-format.patch of Package perl-Date-Tiny

Index: lib/Date/Tiny.pm
===================================================================
--- lib/Date/Tiny.pm.orig
+++ lib/Date/Tiny.pm
@@ -134,6 +134,8 @@
 
 =cut
 
+my $format_string = "%d/%m/%Y";
+
 sub new {
 	my $class = shift;
 	bless { @_ }, $class;
@@ -155,8 +157,9 @@
 =cut
 
 sub now {
-	my @t = localtime time;
-	shift->new(
+    my $class = shift;
+    my @t     = localtime time;
+    $class->new(
 		year  => $t[5] + 1900,
 		month => $t[4] + 1,
 		day   => $t[3],
@@ -217,6 +220,23 @@
 }
 
 
+sub set_format {
+  $format_string = $_[1];
+}
+
+
+sub format {
+  return $_[0]->year 
+    if(!defined $_[0]->day && !defined $_[0]->month);
+  my $res = $format_string;
+  my $day = $_[0]->day;
+  my $month = $_[0]->month;
+  my $year = $_[0]->year;
+  $res =~ s/%d/$day/;
+  $res =~ s/%m/$month/;
+  $res =~ s/%Y/$year/;
+  return $res;
+}
 
 
 
openSUSE Build Service is sponsored by