#19849 closed enhancement (fixed)
Pass $comment_date to get_comment_time filter
Reported by: | lexhair | Owned by: | nacin |
---|---|---|---|
Milestone: | 3.9 | Priority: | normal |
Severity: | minor | Version: | 3.3.1 |
Component: | Comments | Keywords: | has-patch |
Focuses: | Cc: |
Description
I was writing a function to customize the formatted time to include the timezone in the comment meta data using the get_comment_time filter. In order for me to properly indicate whether daylight savings time was in effect at the time of the comment, I needed to globalize $comment to get the comment_time property. The filter passed the $date variable which is the formatted time part of the timestamp but not the $comment_date variable which contained the entire timestamp from $comment. In the function I developed, the $date string wasn't used at all. I returned the formatted time string from $comment->comment_date directly.
Since get_comment_time() already establishes $comment_date, why not pass it to the filter as well?
Attachments (1)
Change History (7)
#2
follow-up:
↓ 3
@
11 years ago
- Keywords has-patch added; close removed
I think we can pass the comment object to the filter in both get_comment_date()
and get_comment_time()
.
#3
in reply to:
↑ 2
@
11 years ago
Replying to SergeyBiryukov:
I think we can pass the comment object to the filter in both
get_comment_date()
andget_comment_time()
.
Thank you. That's the solution I was looking for.
#4
@
11 years ago
- Component changed from Date/Time to Comments
- Milestone changed from Awaiting Review to 3.9
Hi there, apologies that this ticket has remained unanswered for so long.
There is a get_comment_date() function that mirrors the get_comment_time() function with the former returning a formatted date while the latter returns a formatted time.
I think the confusion here is the use of a $date variable in the get_comment_time() function but the core code seems to consider that a 'time' is simply a small part of the overall timestamp which also includes the 'date'.
I think including 'date' information in the get_comment_time() function might confuse further when these 2 functions are available and documented in the codex.