kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2009-09-17 05:01 pm

[dw-free] Bugfix for QotD without dates

[commit: http://hg.dwscoalition.org/dw-free/rev/61ed759bef12]

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

Bugfix for qotd_display_archive function.

Codemerge from LiveJournal; prepared for Dreamwidth by [staff profile] denise.

Files modified:
  • cgi-bin/LJ/Widget/QotD.pm
--------------------------------------------------------------------------------
diff -r 73adf922716a -r 61ed759bef12 cgi-bin/LJ/Widget/QotD.pm
--- a/cgi-bin/LJ/Widget/QotD.pm	Thu Sep 17 11:44:37 2009 -0500
+++ b/cgi-bin/LJ/Widget/QotD.pm	Thu Sep 17 12:00:46 2009 -0500
@@ -151,9 +151,14 @@ sub qotd_display_archive {
             $answer_link = $class->answer_link( $q, user => $opts{user}, button_disabled => $opts{form_disabled} );
         }
 
-        my $date = DateTime->from_epoch( epoch => $q->{time_start}, time_zone => 'America/Los_Angeles' );
+        my $date = '';
+        if ( $q->{time_start} ) {
+            $date = DateTime
+            -> from_epoch( epoch => $q->{time_start}, time_zone => 'America/Los_Angeles' )
+            -> strftime("%B %e, %Y");
+        }
 
-        $ret .= "<p class='qotd-archive-item-date'>" . $date->strftime("%B %e, %Y") . "</p>";
+        $ret .= "<p class='qotd-archive-item-date'>$date</p>";
         $ret .= "<p class='qotd-archive-item-question'>$text</p>";
         $ret .= "<p class='qotd-archive-item-answers'>$answer_link $answers_link" . $class->impression_img($q) . "</p>";
     }
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

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