Skip to content

Commit db4e079

Browse files
committed
Fix comment date display in Social Web feed inspector
Use date_gmt field instead of date for reliable UTC parsing in comment timestamps. This ensures comment dates display correctly using relative time format (5m, 2h, 6d) consistent with post dates.
1 parent f8f4aec commit db4e079

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

build/social-web/feed-inspector.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/social-web/routes/feed/inspector.tsx

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,23 @@ export default function FeedInspector( { id, onClose }: FeedInspectorProps ) {
125125
{ isLoadingComments && <Spinner /> }
126126
{ ! isLoadingComments && comments && comments.length > 0 && (
127127
<div>
128-
{ comments.map( ( comment ) => (
129-
<div key={ comment.id } className="activitypub-inspector-comment">
130-
<div className="activitypub-inspector-comment-meta">
131-
<strong>{ decodeEntities( comment.author_name ) }</strong>
132-
<span className="activitypub-inspector-comment-date">
133-
{ new Date( comment.date ).toLocaleString() }
134-
</span>
128+
{ comments.map( ( comment ) => {
129+
// Use date_gmt for reliable UTC parsing
130+
const commentDate = comment.date_gmt ? getRelativeTime( comment.date_gmt ) : '';
131+
return (
132+
<div key={ comment.id } className="activitypub-inspector-comment">
133+
<div className="activitypub-inspector-comment-meta">
134+
<strong>{ decodeEntities( comment.author_name ) }</strong>
135+
{ commentDate && (
136+
<span className="activitypub-inspector-comment-date">
137+
{ commentDate }
138+
</span>
139+
) }
140+
</div>
141+
<RenderHTML html={ comment.content.rendered } />
135142
</div>
136-
<RenderHTML html={ comment.content.rendered } />
137-
</div>
138-
) ) }
143+
);
144+
} ) }
139145
</div>
140146
) }
141147
{ ! isLoadingComments && ( ! comments || comments.length === 0 ) && (

0 commit comments

Comments
 (0)