Expand description
Small pure helpers shared by views and handlers.
Functions§
- compact_
count - A count short enough to sit beside an icon:
999,1.2k,15k,3.4M. Rounded down, so it never says more than there is. - readable_
size bytesas a size someone reads: in the unit that leaves one to three digits before the point, with one after it past the first unit.- relative_
time - How long ago
thenwas, seen fromnow, as a feed shows it:now,5m,3h,2d,6w,1y. A time in the future (a clock that runs ahead) reads asnow. - truncate_
chars - At most
maxcharacters oftext, with an ellipsis when it was longer. - unix_
now - Seconds since the Unix epoch, now.