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 <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-05-07 16:44:39 +02:00
parent 942c29a395
commit 1e0bd0b51b
3 changed files with 25 additions and 4 deletions

View file

@ -23,7 +23,7 @@ import 'widgets/widgets.dart';
/// Studio's own build version. Bump on every UI commit so the /// Studio's own build version. Bump on every UI commit so the
/// running app self-identifies visible in the sidebar header /// running app self-identifies visible in the sidebar header
/// and quick-glance proof that you're seeing the current build. /// and quick-glance proof that you're seeing the current build.
const String kStudioVersion = '0.14.0'; const String kStudioVersion = '0.14.1';
Future<void> main() async { Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();

View file

@ -125,8 +125,29 @@ class _AuditPageState extends State<AuditPage> {
); );
} }
String _formatTime(DateTime ts) => /// Render the event timestamp so the operator never has to
'${ts.hour.toString().padLeft(2, '0')}:${ts.minute.toString().padLeft(2, '0')}:${ts.second.toString().padLeft(2, '0')}'; /// 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) { String _contextLine(AuditEvent e) {
final parts = <String>[]; final parts = <String>[];

View file

@ -1,7 +1,7 @@
name: fai_studio name: fai_studio
description: "F∆I Studio — desktop GUI for the F∆I hub" description: "F∆I Studio — desktop GUI for the F∆I hub"
publish_to: 'none' publish_to: 'none'
version: 0.14.0 version: 0.14.1
environment: environment:
sdk: ^3.11.0-200.1.beta sdk: ^3.11.0-200.1.beta