JonasWanke/timetable

Change hours locale to different format (from default 12-hour to 24-hour format)

Closed this issue · 2 comments

How can hours localisation be changed from 12-hour format (AM/PM) to 24-hour format? I thought that first item from _supportedLocales would be considered as default, therefore I have tried to set italy as first item in a list but that did not changed hour format in timetable

image

final _supportedLocales = [
  const Locale('it'),
  const Locale('de'),
  const Locale('en'),
  const Locale('es'),
  const Locale('fr'),
  const Locale('ja'),
  const Locale('pt'),
  const Locale('zh', 'CN'),
  const Locale('zh', 'TW'),
];

The locale is taken from Flutter's locale, i.e., Localizations.localeOf(context). The order in _supportedLocales doesn't matter.

To force Timetable to always use the 24 hour format, use timeIndicatorStyle.alwaysUse24HourFormat.

timeIndicatorStyle.alwaysUse24HourFormat

Thank you that is exactly what i needed!