Finally added support for half typed date strings which really should
authorJoey Schulze <joey@infodrom.org>
Wed, 16 Oct 2002 17:55:27 +0000 (17:55 +0000)
committerJoey Schulze <joey@infodrom.org>
Wed, 16 Oct 2002 17:55:27 +0000 (17:55 +0000)
be sufficient.

src/InfoCon/buch/infocon

index c634977..da37618 100755 (executable)
@@ -219,6 +219,8 @@ sub buchung_input
     my $weiter = 'y';
     my $i;
     my $query;
+    my ($date_sec,$date_min,$date_hour,$date_mday,$date_mon,$date_year,$date_wday,$date_isdst)
+       = localtime();
 
     print "Buchungseingabe\n\n";
     while ($weiter =~ /[JjYy]/) {
@@ -227,6 +229,19 @@ sub buchung_input
            if ($fieldname[$i] eq "Category" && $ans eq "?") {
                @categories = &get_categories() if ($#categories);
                printf "  %s\n", join (", ",@categories);
+           } elsif ($fieldname[$i] eq "Datum") {
+               if ($ans =~ /^\d+\.\d+.\d+$/) {
+                   $input[$i] = $ans;
+                   $i++;
+               } elsif ($ans =~ /^\d+\.\d+.$/) {
+                   $ans .= $date_year + 1900;
+                   $input[$i] = $ans;
+                   $i++;
+               } elsif ($ans =~ /^\d+\.$/) {
+                   $ans .= sprintf ("%d.%d", $date_mon + 1, $date_year + 1900);
+                   $input[$i] = $ans;
+                   $i++;
+               }
            } else {
                $input[$i] = $ans;
                $i++;