mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-05-10 06:13 am

[dw-free] human-friendly profile birthdays

[commit: http://hg.dwscoalition.org/dw-free/rev/21c6be8bb177]

http://bugs.dwscoalition.org/show_bug.cgi?id=1121

Display birthday on profile as 'Mon DD' or 'Mon DD, YYYY' instead of the
confusing 'MM-DD'.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/DW/Logic/ProfilePage.pm
--------------------------------------------------------------------------------
diff -r 1c97618605a6 -r 21c6be8bb177 cgi-bin/DW/Logic/ProfilePage.pm
--- a/cgi-bin/DW/Logic/ProfilePage.pm	Sun May 10 05:58:55 2009 +0000
+++ b/cgi-bin/DW/Logic/ProfilePage.pm	Sun May 10 06:13:37 2009 +0000
@@ -377,7 +377,16 @@ sub _basic_info_birthday {
         my $bdate = $u->prop( 'bdate' );
         if ( $bdate && $bdate ne "0000-00-00" ) {
             $ret->[0] = LJ::Lang::ml( '.label.birthdate' );
-            $ret->[1] = $u->bday_string;
+            my ($year, $mon, $day) = split /-/, $bdate;
+            my $moname = LJ::Lang::month_short_ml( $mon );
+            $day += 0;
+            if ( $u->bday_string =~ /\d+-\d+-\d+/ ) {
+                $ret->[1] = "$moname $day, $year";
+            } elsif ( $u->bday_string =~ /\d+-\d+/ ) {
+                $ret->[1] = "$moname $day";
+            } else {
+                $ret->[1] = $u->bday_string;
+            }
         }
     }
 
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org