genorg.pl
changeset 23 b339b5ef7c97
parent 22 dc1add4ee525
--- a/genorg.pl	Sun Jan 12 16:14:26 2025 +1000
+++ b/genorg.pl	Sun Jan 12 23:49:38 2025 +1000
@@ -635,7 +635,8 @@
   for ($dom->findnodes('/html/body/div[@id="postamble"]/p[@class="date"]')) {
     my $text = $_->to_literal;
     if ($text =~ /^Date: (\d+)-(\d+)-(\d+)/) {
-      my $date = PDate->new($1, $2, $3);
+      # Well, at least you will learn something new
+      my $date = PDate->new(@{^CAPTURE});
       $data{date} = $date;
       my $p = $_->parentNode;
       $p->parentNode->removeChild($p);
@@ -708,8 +709,8 @@
       qw(January Febuary March April May June July August September November October December);
     my $n = $self->{day};
     if ($n == 1) { $n = '1st' }
-    elsif (($n - 2) % 10 == 0) { $n = "${n}nd" }
-    elsif (($n - 3) % 10 == 0) { $n = "${n}rd" }
+    elsif ($n == 22 || $n == 2) { $n = "${n}nd" }
+    elsif ($n == 23 || $n == 3) { $n = "${n}rd" }
     else { $n = "${n}th" }
     $months[$self->{month} - 1] . " $n, " . $self->{year}
   }