From 1e0bd0b51bccf8efb5c59a86639ded4d02ba4922 Mon Sep 17 00:00:00 2001 From: flemming-it Date: Thu, 7 May 2026 16:44:39 +0200 Subject: [PATCH] fix(studio): audit timestamps show date when not from today (v0.14.1) Previously the audit list only rendered HH:mm:ss, so a row showing "21:25:39" gave no hint whether it was today, last week, or last year. The detail dialog already had the full ISO timestamp, but the operator had to click each row to find out. _formatTime now keeps the compact HH:mm:ss form for same-day events, prefixes MM-dd for older days in the current year, and shows YYYY-MM-dd for the tail of the log. Always rendered in the operator's local time zone. Signed-off-by: flemming-it --- lib/main.dart | 2 +- lib/pages/audit.dart | 25 +++++++++++++++++++++++-- pubspec.yaml | 2 +- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 4cb8c5f..0bb6c77 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -23,7 +23,7 @@ import 'widgets/widgets.dart'; /// Studio's own build version. Bump on every UI commit so the /// running app self-identifies — visible in the sidebar header /// and quick-glance proof that you're seeing the current build. -const String kStudioVersion = '0.14.0'; +const String kStudioVersion = '0.14.1'; Future main() async { WidgetsFlutterBinding.ensureInitialized(); diff --git a/lib/pages/audit.dart b/lib/pages/audit.dart index 9e83456..dd3ba1a 100644 --- a/lib/pages/audit.dart +++ b/lib/pages/audit.dart @@ -125,8 +125,29 @@ class _AuditPageState extends State { ); } - String _formatTime(DateTime ts) => - '${ts.hour.toString().padLeft(2, '0')}:${ts.minute.toString().padLeft(2, '0')}:${ts.second.toString().padLeft(2, '0')}'; + /// Render the event timestamp so the operator never has to + /// guess what day "21:25" was. Same-day events keep the + /// compact `HH:mm:ss` form; older events get a `MM-dd` prefix + /// or a full `YYYY-MM-dd` for last year's tail of the log. + /// Always rendered in the operator's local time zone — the + /// dialog still shows the full ISO timestamp for unambiguous + /// cross-checking. + String _formatTime(DateTime ts) { + final local = ts.toLocal(); + final now = DateTime.now(); + final hh = local.hour.toString().padLeft(2, '0'); + final mm = local.minute.toString().padLeft(2, '0'); + final ss = local.second.toString().padLeft(2, '0'); + final time = '$hh:$mm:$ss'; + final sameDay = local.year == now.year && + local.month == now.month && + local.day == now.day; + if (sameDay) return time; + final mo = local.month.toString().padLeft(2, '0'); + final dd = local.day.toString().padLeft(2, '0'); + if (local.year == now.year) return '$mo-$dd $time'; + return '${local.year}-$mo-$dd $time'; + } String _contextLine(AuditEvent e) { final parts = []; diff --git a/pubspec.yaml b/pubspec.yaml index 6484194..2f43a59 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: fai_studio description: "F∆I Studio — desktop GUI for the F∆I hub" publish_to: 'none' -version: 0.14.0 +version: 0.14.1 environment: sdk: ^3.11.0-200.1.beta