From fc867b33a14db0dbe16d81eed098a7f296ca701a Mon Sep 17 00:00:00 2001 From: Krille Date: Thu, 4 Jul 2024 10:59:52 +0200 Subject: [PATCH] chore: Follow up time of day format --- lib/utils/date_time_extension.dart | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/utils/date_time_extension.dart b/lib/utils/date_time_extension.dart index f546f9a5..d02f4533 100644 --- a/lib/utils/date_time_extension.dart +++ b/lib/utils/date_time_extension.dart @@ -35,7 +35,9 @@ extension DateTimeExtension on DateTime { /// Returns a simple time String. String localizedTimeOfDay(BuildContext context) => - DateFormat.Hm(L10n.of(context)!.localeName).format(this); + MediaQuery.of(context).alwaysUse24HourFormat + ? DateFormat('HH:mm', L10n.of(context)!.localeName).format(this) + : DateFormat('h:mm a', L10n.of(context)!.localeName).format(this); /// Returns [localizedTimeOfDay()] if the ChatTime is today, the name of the week /// day if the ChatTime is this week and a date string else.