Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix timetable when device locale is set to Arabic #904

Merged
merged 1 commit into from
Sep 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/time/lib/src/time.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,19 @@ class Time {
final String _time;

factory Time({required int hour, int minute = 0}) {
final numberFormat = NumberFormat("00");
final numberFormat = NumberFormat(
"00",
// We need to set the locale to "de_DE", otherwise the number formatter
// will use the device's locale, which can cause problems if the number
// formatter does not work as we expect, e.g. if the device is set to
// Arabic.
//
// If we go international with Sharezone, we should probably remove this
// and instead use a number formatter that is locale independent.
//
// See: https://github.com/SharezoneApp/sharezone-app/issues/903
"de_DE",
);
return Time._(
"${numberFormat.format(hour)}:${numberFormat.format(minute)}");
}
Expand Down