Repository navigation
Closed
flutter/packages
#13035Labels
a: internationalizationSupporting other languages or locales. (aka i18n)Supporting other languages or locales. (aka i18n)f: date/time pickerDate or time picker widgetsDate or time picker widgetsfound in release: 2.2Found to occur in 2.2Found to occur in 2.2found in release: 2.3Found to occur in 2.3Found to occur in 2.3has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Steps to Reproduce
TextButton(
onPressed: () {
showTimePicker(
initialTime: TimeOfDay.now(),
context: context,
builder: (BuildContext context, Widget? child) {
return MediaQuery(
data:
MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true),
child: child!,
);
},
);
},
child: const Text('Show picker'),
);Expected results:
I am using showTimePicker to open time picker , it works well, but I have a problem that I am unable to reproduce it in a minimal project
In my project, When time picker opened it use 24 hour format, both dial and input mode works well, just when you pick a time in dial mode and switch to input mode and press ok button, we have Enter a valid time error
I just figured out by changing locale and supportedLocales of MaterialApp to Locale("en", "US") everything is OK
I am using the following config in MaterialApp
localizationsDelegates: [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
DefaultCupertinoLocalizations.delegate
],
supportedLocales: [
Locale("fa", "IR"),
],
locale: Locale("fa", "IR")),and have زمان معتبری وارد کنید error, it's my guess that may be we have problem with persian/arabic numbers
Actual results:
Logs
[√] Flutter (Channel stable, 2.2.2, on Microsoft Windows [Version 10.0.18363.1621], locale en-US)
• Flutter version 2.2.2 at C:\flutter
• Framework revision d79295af24 (3 weeks ago), 2021-06-11 08:56:01 -0700
• Engine revision 91c9fc8fe0
• Dart version 2.13.3
Reacted by Pascal Stech, Lenard Wiedekamp, fjwong, Harsh Bangari , Łukasz Gawron, Maurizio Pinotti and steffenhaak
Metadata
Metadata
Assignees
Labels
a: internationalizationSupporting other languages or locales. (aka i18n)Supporting other languages or locales. (aka i18n)f: date/time pickerDate or time picker widgetsDate or time picker widgetsfound in release: 2.2Found to occur in 2.2Found to occur in 2.2found in release: 2.3Found to occur in 2.3Found to occur in 2.3has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagespackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Activity
sm2017 commentedon Jun 29, 2021
TahaTesser commentedon Jun 30, 2021
Hi @sm2017
Thanks for filing the issue, Indeed the error is only with Persian locale, I've tried Hebrew, Arabic, Chinese, no issues with the time picker. I can reproduce the issue without specifying 24 hour too
Used the following minimal code sample
minimal code sample
stablemasterCheck
flutter doctor -voutputs for each channel belowflutter doctor -v
✅ : No Issue ❌: Issue reproduced
[-]Enter a valid time[/-][+][TimePicker] `Enter a valid time` error in Persian locale[/+]HansMuller commentedon Jun 30, 2021
CC @darrenaustin
woprandi commentedon Jul 13, 2021
Same issue with French locale (stable to master)

[-][TimePicker] `Enter a valid time` error in Persian locale[/-][+][TimePicker] `Enter a valid time` error in some locales[/+]10 remaining items
MohammadGhodsian commentedon Nov 6, 2023
It's unusual that the problem is resolved by re-entering the numbers through the keyboard.
Until this issue is fixed, we can try using TimePickerEntryMode and setting it to dialOnly. This may help create a cleaner picker and prevent users from switching to the input layout.
Here's the definition of TimePickerEntryMode for reference:
For example, when using the 'fa_IR' locale, the picker looks like this:

And for the 'en_US' locale, it appears as follows:

BretechCode commentedon Mar 18, 2024
Are there any fixes to this issue?
my code:

final TimeOfDay? picked = await showTimePicker(
context: context,
initialTime: isStart ? _startTime : _endTime,
initialEntryMode: TimePickerEntryMode.input,
);
issue:
lyabs243 commentedon Mar 27, 2024
@BretechCode
You can fix that by building the time picker in a MediaQuery widget:
ClementCardonnel commentedon Oct 25, 2024
This is still an issue. 24 hours formats do not work with French locale on web. @lyabs243 workaround is an ok fix in the meantime (thank you!).
tiagosilveiransj commentedon Dec 23, 2024
Same happens with Brazilian Locale (Web)
ikso95 commentedon Feb 12, 2025
It's frustrating that a bug reported so long ago hasn't been taken care of yet. We're talking about a basic component here
ToH2002 commentedon Mar 20, 2026
same issue with German locale. Quite an annoyance to have this issue persist for such a long time...
[material_ui] Fix for time picker error in locales that do not use La…
github-actions commentedon Nov 5, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.