Prompted by @tmninja mistaking “Apr 17” for “Apr '17”, and @plantron’s suggestion that Discourse should change their format.
What
Examples of the default timestamps are: 3m, 5h, 1d, Apr 17, Apr '17
As you see they tell us as little as possible and can easily cause confusion. This script provides more detailed timestamps. The table below uses relative time for anything less than 4 hours old, and relative dates for anything less than 7 day old. Where it stops being relative is, however, a setting at the top of the script, just like short format and 12- or 24-hour times are.
Let’s assume a post was posted 6:55 AM August 16, 2016.
Time since post
Forum Default
Short Format 12h
Short Format 24h
Long Format 12h
Long Format 24h
30 seconds
1m
< 1m
< 1m
< 1 minute
< 1 minute
5 minutes
5m
5m
5m
5 minutes
5 minutes
1h 10m
1h
1h 10m
1h 10m
1 hour 10 minutes
1 hour 10 minutes
3h 31m
4h
3h 31m
3h 31m
3 hours 31 minutes
3 hours 31 minutes
4h 50m
5h
6:55 AM
06:55
Today at 6:55 AM
Today at 06:55
1d 1h
1d
1d, 6:55 AM
1d, 06:55
Yesterday at 6:55 AM
Yesterday at 06:55
2d 3h
2d
2d, 6:55 AM
2d, 06:55
2 days, 6:55 AM
2 days, 06:55
8d
8d
Aug 16 6:55 AM
Aug 16 06:55
Aug 16 6:55 AM
Aug 16 06:55
2 months
Aug 16
Aug 16 6:55 AM
Aug 16 06:55
Aug 16 6:55 AM
Aug 16 06:55
1 year
Aug '16
Aug 16, 2016
Aug 16, 2016
Aug 16, 2016
Aug 16, 2016
The available settings are:
AmPmTimes: true or false depending on whether you’re on 12-hour or 24-hour clock.
shortFormat: true or false depending on whether you want d, h, m, s, instead of the full words.
relativeHours: the number of hours you want to be relative before it starts displaying the exact time.
relativeDays: the number of dates you want to be relative before it starts displaying the exact date.
You’re right, it makes more sense to do it that way, since I do MM DD hh:mm before that. I’ll just make that the default.
@seanblue While you’re here can I ask your opinion on making it 2 hours 40 minutes instead of 2h 40m ago. The latter doesn’t really fit in with the other formats.
Honestly I’d just use h, m, and s everywhere that isn’t using a full timestamp. Also, you should use or not use “ago” consistently for all of the non-timestamp versions (I have no preference which way).
P.S. I was “here” as in typing furiously while at a red light.
Added short format (h, m, s) as an option and made it default. I made it default because that’s how it’s done natively.
@seanblue How do you feel about the relative dates? Would you prefer “Today 06:55” and “Yesterday 16:15” to be shortened to “06:55” and “1d ago at 16:15”, or something similar?
I’m in bed now (no computer), but I’ll try tomorrow.
Do you think it makes sense to make 30 days / 24 hours the default settings? By doing that, all the defaults would match the forum’s actual defaults. So your script (by default) would just make the times more precise and better formatted.
@Kumirei It’s a little weird having the time just tick up every second for new posts. I’d recommend scrapping the seconds display and changing it to < 1m in short format and < 1 minute in long format. Plus, then you’d only have to have the code update the UI once a minute.