Merge branch 'hour12' into 'master'

(Actually)Fix wrong message time

Closes #30

See merge request ChristianPauly/fluffychat-flutter!114
This commit is contained in:
Christian Pauly 2020-07-21 08:53:05 +00:00
commit fe74f9638a

View file

@ -34,7 +34,7 @@ extension DateTimeExtension on DateTime {
/// Returns a simple time String.
/// TODO: Add localization
String localizedTimeOfDay(BuildContext context) {
return L10n.of(context).timeOfDay(_z(hour == 12 ? hour : hour % 12),
return L10n.of(context).timeOfDay(_z(hour % 12 == 0 ? 12 : hour % 12),
_z(hour), _z(minute), hour > 11 ? 'pm' : 'am');
}