Scratch-www: Comments display "in x seconds" as opposed to "x seconds ago"

Created on 20 Aug 2020  路  10Comments  路  Source: LLK/scratch-www

Expected Behavior

_Under the comment when it is posted it should say x seconds ago, when it is just posted._

Actual Behavior

_Under the comment when it is just posted it says "in x seconds" for a short amount of time, then goes to posted x seconds ago_

Steps to Reproduce

_Comment and look closely at the time of how long ago it was posted_

Operating System and Browser

_ChromeOS 13099.102.0, Chrome 84.0.4147.127_
Screenshot 2020-08-20 at 8 35 52 AM

High Impact Low Severity bug help wanted priority 3

All 10 comments

This issue would better fit in the scratch-www repository, instead of scratch-gui.

This issue would better fit in the scratch-www repository, instead of scratch-gui.

@SausageMcSauce Oh, ok sorry about that, I'm new to the scratch github. Is there any way that it can be moved or should I just close this and repost?

I think that the 'in 1 second' is a react-intl thing. The posting time of the comment might be one second in the future, causing that to happen.

Can't repro.
ChromeOS, Latest Chrome

I think that the 'in 1 second' is a react-intl thing. The posting time of the comment might be one second in the future, causing that to happen.

I do remember, although I can't seem to reproduce it that I once got a forum notification saying "in 18 seconds" so I'm not sure if you're correct. However that was a while ago so it may have been patched.

I might have found a fix. @benjiwheeler Can you make this help wanted?
Proposal:
https://github.com/LLK/scratch-www/blob/9b910d900e334b112a9047788d0cca407e422b3c/src/components/comment/comment.jsx#L21

- <FormattedRelative value={new Date(props.datetimeCreated)} /> 
+ <FormattedRelative value={new Date(props.datetimeCreated).getTime() > new Date().getTime() ? new Date() : new Date(props.datetimeCreated)} /> 

It will show 'now' if the post time is in the future.

Maybe he forgot. cc@benjiwheeler ^^

Sorry @BoomerScratch, this one fell through the cracks! Please do submit your fix!

I think that the 'in 1 second' is a react-intl thing. The posting time of the comment might be one second in the future, causing that to happen.

Pretty sure it's not - I once had a comment that scratch claimed was "going to post" in 32 minutes. The comment posted instantly in reality.

weird and kweepy

Was this page helpful?
0 / 5 - 0 ratings