Time Stamps in New Module Library

Is there a way to improve the details in the Time Stamps in the New Module Library? The Current System of 2 Months Ago or 3 Years Ago is seems rather ambiguous and arbitrary. For Example: The Time Stamp for This Post is 20260114.

1 Like

I’d like the “Updated” in indicator to use a similar approach to “Activity” column in the Discourse forums. Hour, Days, Week then the actual month and year.

For individual files on a module page it could be the same, or perhaps the full timestamp.

It would help me to have a view that shows module page changes by last-updated date, either by default or as an option.

I raised this issue a while ago, perhaps discussion in this thread will help flesh out the details of a requirement or generate a separate issue. Then it will need someone able to take on the development.

Aside: This thread should be tagged under “Feature Requests”.

The “distance” is formatted by the Javascript function formatDistance. The current logic is

d <= number of seconds since given time and now

if d >= number of seconds in a year then
  n <= d / number of seconds in a year
  u <= year 
else if d >= number of seconds in a month then
  n <= d / number of seconds in a year
  u <= month
else if d >= number of seconds in a week then 
  n <= d / number of seconds in a week 
  u <= week
else if d >= number of seconds in a day then
  n <= d / number of seconds in a day
  u <= day
else if d >= number of seconds in an hour then
  n <= d / number of seconds in an hour 
  u <= hour
else if d >= number of seconds in a minute then 
  n <= d / number of seconds in an hour 
  u <= minute
else 
  n <= d
  u <= seconds 

v = round down d 

l = format n and u in a string

Another way to do it would be to do

d <= number of seconds since given time and now
r <= d
o = [number of seconds in a year,
     number of seconds in a month,
     number of seconds in a week,
     number of seconds in a day,
     number of seconds in an hour,
     number of seconds in a minute
     number of seconds in a second]
u <= [year,
      month,
      day,
      hour,
      minute,
      second]

s <= empty string
for oo, uu in o and u do 
  if r < oo then 
    continue
  end if

  nn = round down r / oo 
  if nn == 0 then 
     continue 
  end if

  r    = r - nn * oo
  
  append format nn and uu to s 
end for 

which would format the output as

1 year 3 month 5 day 15 minute and 3 seconds"

Yours,
Christian