@@ -2011,9 +2011,30 @@ enum MessageTimestampStyle {
20112011 return DateFormat .yMMMd ().format (dateTime);
20122012 }
20132013 }
2014- static final _timeFormat = DateFormat ('h:mm aa' );
2015- static final _timeFormatWithSeconds = DateFormat ('Hms' );
2016- static final _lightboxFormat = DateFormat .yMMMd ().addPattern (_timeFormatWithSeconds.pattern);
2014+
2015+ static final _timeFormat12 = DateFormat ('h:mm aa' );
2016+ static final _timeFormat24 = DateFormat ('Hm' );
2017+ static final _timeFormatLocaleDefault = DateFormat ('jm' );
2018+ static final _timeFormat12WithSeconds = DateFormat ('h:mm:ss aa' );
2019+ static final _timeFormat24WithSeconds = DateFormat ('Hms' );
2020+ static final _timeFormatLocaleDefaultWithSeconds = DateFormat ('jms' );
2021+
2022+ // ignore: unused_element
2023+ static DateFormat _resolveTimeFormat (TwentyFourHourTimeMode mode) => switch (mode) {
2024+ TwentyFourHourTimeMode .twelveHour => _timeFormat12,
2025+ TwentyFourHourTimeMode .twentyFourHour => _timeFormat24,
2026+ TwentyFourHourTimeMode .localeDefault => _timeFormatLocaleDefault,
2027+ };
2028+
2029+ // ignore: unused_element
2030+ static DateFormat _resolveTimeFormatWithSeconds (TwentyFourHourTimeMode mode) => switch (mode) {
2031+ TwentyFourHourTimeMode .twelveHour => _timeFormat12WithSeconds,
2032+ TwentyFourHourTimeMode .twentyFourHour => _timeFormat24WithSeconds,
2033+ TwentyFourHourTimeMode .localeDefault => _timeFormatLocaleDefaultWithSeconds,
2034+ };
2035+
2036+ static final _lightboxFormat =
2037+ DateFormat .yMMMd ().addPattern (_timeFormat24WithSeconds.pattern);
20172038 static final _fullFormat = DateFormat .yMMMd ().add_jm ();
20182039
20192040 /// Format a [Message.timestamp] for this mode.
@@ -2032,7 +2053,7 @@ enum MessageTimestampStyle {
20322053 case dateOnlyRelative:
20332054 return _formatDateOnlyRelative (asDateTime,
20342055 now: now, zulipLocalizations: zulipLocalizations);
2035- case timeOnly: return _timeFormat .format (asDateTime);
2056+ case timeOnly: return _timeFormat12 .format (asDateTime);
20362057 case lightbox: return _lightboxFormat.format (asDateTime);
20372058 case full: return _fullFormat.format (asDateTime);
20382059 }
0 commit comments