diff mod_client_management/mod_client_management.lua @ 5374:d9397d6a5513

mod_client_management: Show time for recent timestamps in shell command Semi-fuzzy time is nice
author Kim Alvefur <zash@zash.se>
date Wed, 26 Apr 2023 12:42:09 +0200
parents 93d6ed7dc779
children f25df3af02c1
line wrap: on
line diff
--- 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;
 			};
 			{