holyandrew (holyandrew) wrote in changelog,
holyandrew
holyandrew
changelog

[livejournal] r22832: LJSUP-13558: Change date format of creat...

Committer: akanashin
LJSUP-13558: Change date format of creation date and last updated
U   trunk/cgi-bin/LJ/User.pm
Modified: trunk/cgi-bin/LJ/User.pm
===================================================================
--- trunk/cgi-bin/LJ/User.pm	2012-09-06 15:25:57 UTC (rev 22831)
+++ trunk/cgi-bin/LJ/User.pm	2012-09-07 06:44:31 UTC (rev 22832)
@@ -1730,7 +1730,7 @@
 
 # This will format the birthdate based on the user prop
 sub bday_string {
-    my $u = shift;
+    my ($u, %opts) = @_;
     croak "invalid user object passed" unless LJ::isu($u);
     return 0 if $u->underage;
 
@@ -1738,12 +1738,24 @@
     my ($year,$mon,$day) = split(/-/, $bdate);
     my $bday_string = '';
 
-    if ($u->can_show_full_bday && $day > 0 && $mon > 0 && $year > 0) {
-        $bday_string = $bdate;
-    } elsif ($u->can_show_bday && $day > 0 && $mon > 0) {
-        $bday_string = "$mon-$day";
-    } elsif ($u->can_show_bday_year && $year > 0) {
-        $bday_string = $year;
+    if ($opts{'format'}) {
+        if ($u->can_show_full_bday && $day > 0 && $mon > 0 && $year > 0) {
+            $mon = LJ::Lang::ml(LJ::Lang::month_long_langcode($mon)); 
+            $bday_string = sprintf("%02d %s %04d", $day, $mon, $year);
+        } elsif ($u->can_show_bday && $day > 0 && $mon > 0) {
+            $mon = LJ::Lang::ml(LJ::Lang::month_long_langcode($mon)); 
+            $bday_string = sprintf("%02d %s", $day, $mon);
+        } elsif ($u->can_show_bday_year && $year > 0) {
+            $bday_string = $year;
+        }
+    } else {
+        if ($u->can_show_full_bday && $day > 0 && $mon > 0 && $year > 0) {
+            $bday_string = $bdate; #sprintf("%02d %s %04d", $day, $mon, $year);
+        } elsif ($u->can_show_bday && $day > 0 && $mon > 0) {
+            $bday_string = "$mon-$day"; #sprintf("%02d %s, $day, $mon");
+        } elsif ($u->can_show_bday_year && $year > 0) {
+            $bday_string = $year;
+        }
     }
     $bday_string =~ s/^0000-//;
     return $bday_string;

Tags: akanashin, holyandrew, livejournal, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments