Changeset

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 5373:93d6ed7dc779
children 5375:8b7d97f0ae8a
files mod_client_management/mod_client_management.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
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;
 			};
 			{