handle comment time display correctly immediately after posting

This commit is contained in:
Sean Yesmunt 2020-10-05 11:44:38 -04:00
parent d121f5c39c
commit 61dfc2f74a
3 changed files with 10 additions and 5 deletions

View file

@ -177,9 +177,9 @@ function Comment(props: Props) {
className="button--uri-indicator" className="button--uri-indicator"
navigate={`${uri}?lc=${commentId}`} navigate={`${uri}?lc=${commentId}`}
label={ label={
<time className="comment__time" dateTime={timePosted}> <span className="comment__time">
{DateTime.getTimeAgoStr(timePosted)} <DateTime date={timePosted} timeAgo />
</time> </span>
} }
/> />
</div> </div>

View file

@ -35,7 +35,12 @@ class DateTime extends React.PureComponent<Props> {
// Strip off the 's' for the singular suffix, construct the string ID, // Strip off the 's' for the singular suffix, construct the string ID,
// then load the localized version. // then load the localized version.
const suffix = duration === 1 ? suffixList[i].substr(0, suffixList[i].length - 1) : suffixList[i]; const suffix = duration === 1 ? suffixList[i].substr(0, suffixList[i].length - 1) : suffixList[i];
const strId = '%duration% ' + suffix + ' ago'; let strId = '%duration% ' + suffix + ' ago';
if (!suffix) {
strId = 'Just now';
}
return __(strId, { duration }); return __(strId, { duration });
} }

View file

@ -151,7 +151,7 @@ $thumbnailWidthSmall: 1.5rem;
} }
.comment__time { .comment__time {
opacity: 0.3; opacity: 0.5;
white-space: nowrap; white-space: nowrap;
height: 100%; height: 100%;
} }