mod_client_management: Show time for recent timestamps in shell command
Semi-fuzzy time is nice
--- a/mod_client_management/mod_client_management.lua Wed Apr 26 12:12:34 2023 +0200
+++ b/mod_client_management/mod_client_management.lua Wed Apr 26 12:42:09 2023 +0200
@@ -429,9 +429,10 @@
{
title = "Last seen";
key = "last_seen";
- width = 10;
+ width = math.max(#os.date("%Y-%m-%d"), #os.date("%H:%M:%S"));
+ align = "right";
mapper = function(last_seen)
- return os.date("%Y-%m-%d", last_seen);
+ return os.date(os.difftime(os.time(), last_seen) >= 86400 and "%Y-%m-%d" or "%H:%M:%S", last_seen);
end;
};
{