[wp-trac] [WordPress Trac] #19171: date display
WordPress Trac
wp-trac at lists.automattic.com
Sat Nov 5 20:38:21 UTC 2011
#19171: date display
--------------------------+-----------------------------
Reporter: Lordrach | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Date/Time | Version: 3.2.1
Severity: normal | Keywords: needs-patch
--------------------------+-----------------------------
Hello,
While setting up a wordpress site for a gaming community I was suprised
that comment dates were shown like this :
Your comment is awaiting moderation.
%A %B %e%q, %Y at %I:%M %p
after some researches in the source code and randomly modifying it, I got
desperate and then I wanted to see what $comment->comment_date; contain,
and there was my surprise, the output was already formatted : 2011-11-05
19:10:32
containing the full date at the format y-m-d H:m:s
I went through the code and modified it this way to get it fixed :
(line 372)
{{{
function get_comment_date( $d = '', $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
/*
if ( '' == $d )
$date = mysql2date(get_option('date_format'),
$comment->comment_date);
else
$date = mysql2date($d, $comment->comment_date);
*/
if ( '' == $d )
$d = get_option('date_format');
//return apply_filters('get_comment_date', $date, $d);
return $comment->comment_date;
}}}
(line 634)
{{{
function get_comment_time( $d = '', $gmt = false, $translate = true ) {
global $comment;
$comment_date = $gmt ? $comment->comment_date_gmt :
$comment->comment_date;
/*
if ( '' == $d )
$date = mysql2date(get_option('time_format'),
$comment_date, $translate);
else
$date = mysql2date($d, $comment_date, $translate);
return apply_filters('get_comment_time', $date, $d, $gmt,
$translate);
*/
return "";
}
}}}
(line 1371)
{{{
<div class="comment-meta commentmetadata"><a href="<?php echo
htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
<?php
/* translators: 1: date, 2: time */
/*printf( __('%1$s at %2$s'),
get_comment_date(), get_comment_time()) ?></a><?php
edit_comment_link(__('(Edit)'),' ','' );*/
printf( __('%1$s'), get_comment_date(),
get_comment_time()) ?></a><?php
edit_comment_link(__('(Edit)'),' ','' );
?>
</div>
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19171>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list