@@ -2011,9 +2011,30 @@ enum MessageTimestampStyle {
2011
2011
return DateFormat .yMMMd ().format (dateTime);
2012
2012
}
2013
2013
}
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);
2017
2038
static final _fullFormat = DateFormat .yMMMd ().add_jm ();
2018
2039
2019
2040
/// Format a [Message.timestamp] for this mode.
@@ -2032,7 +2053,7 @@ enum MessageTimestampStyle {
2032
2053
case dateOnlyRelative:
2033
2054
return _formatDateOnlyRelative (asDateTime,
2034
2055
now: now, zulipLocalizations: zulipLocalizations);
2035
- case timeOnly: return _timeFormat .format (asDateTime);
2056
+ case timeOnly: return _timeFormat12 .format (asDateTime);
2036
2057
case lightbox: return _lightboxFormat.format (asDateTime);
2037
2058
case full: return _fullFormat.format (asDateTime);
2038
2059
}
0 commit comments