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

[FormBuilderDateTimePicker]: FormBuilderDateTimePicker not allow me to use 12Hour Format #1391

Open
2 of 7 tasks
GuikiPT opened this issue May 16, 2024 · 0 comments
Open
2 of 7 tasks
Labels
bug Something isn't working

Comments

@GuikiPT
Copy link

GuikiPT commented May 16, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

9.1.0

Platforms

  • Android
  • iOS
  • Linux
  • MacOS
  • Web
  • Windows

Flutter doctor

[✓] Flutter (Channel stable, 3.16.9, on Zorin OS 17.1 6.5.0-28-generic, locale
    pt_PT.UTF-8)
    • Flutter version 3.16.9 on channel stable at
      /home/luis/.flutter-path/3.16.9
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 41456452f2 (4 months ago), 2024-01-25 10:06:23 -0800
    • Engine revision f40e976bed
    • Dart version 3.2.6
    • DevTools version 2.28.5

[!] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /home/luis/Android/Sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at:
      /home/luis/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor
      --android-licenses

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • Ubuntu clang version 14.0.0-1ubuntu1.1
    • cmake version 3.22.1
    • ninja version 1.10.1
    • pkg-config version 0.29.2

[✓] Android Studio (version 2023.3)
    • Android Studio at
      /home/luis/.local/share/JetBrains/Toolbox/apps/android-studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.10+0-17.0.10b1087.21-11572160)

[✓] VS Code (version 1.89.0)
    • VS Code at /usr/share/code
    • Flutter extension version 3.88.0

[✓] Connected device (2 available)
    • Linux (desktop) • linux  • linux-x64      • Zorin OS 17.1 6.5.0-28-generic
    • Chrome (web)    • chrome • web-javascript • Google Chrome 124.0.6367.155

[✓] Network resources
    • All expected network resources are available.

Minimal code example

const SizedBox(width: 8.0),
Flexible(
  child: FormBuilderDateTimePicker(
    inputType: InputType.time,
    style: Theme.of(context).textTheme.bodySmall,
    name: 'pt_PT',
    decoration: textFormFieldDecoration(
        context, 'Test pt_PT'),
    initialDate: DateTime.now(),
    initialTime: TimeOfDay.now(),
  ),
),

const SizedBox(width: 8.0),
Flexible(
  child: FormBuilderDateTimePicker(
    format: DateFormat('HH:mm'),
    inputType: InputType.time,
    style: Theme.of(context).textTheme.bodySmall,
    name: 'en_UK',
    decoration: textFormFieldDecoration(
        context, 'Test en_UK'),
    initialDate: DateTime.now(),
    initialTime: TimeOfDay.now(),
    onChanged: (value) {},
    locale: Locale('en', 'UK'),
  ),
),

Current Behavior

When switching to input text mode to enter time manually, it won't let me put a time above 12hrs.

Furthermore, there is no AM/PM selector in certain locations, such as in my case Locale('pt', 'PT'), but if I change the Locale of FormBuilderDateTimePicker to Locale('en', 'UK') An option will appear to choose AM/PM

Expected Behavior

I want to use AM/PM selector outside Locale('en', 'UK')

Steps To Reproduce

Testing Code:

const SizedBox(width: 8.0),
Flexible(
  child: FormBuilderDateTimePicker(
    inputType: InputType.time,
    style: Theme.of(context).textTheme.bodySmall,
    name: 'pt_PT',
    decoration: textFormFieldDecoration(
        context, 'Test pt_PT'),
    initialDate: DateTime.now(),
    initialTime: TimeOfDay.now(),
  ),
),

const SizedBox(width: 8.0),
Flexible(
  child: FormBuilderDateTimePicker(
    format: DateFormat('HH:mm'),
    inputType: InputType.time,
    style: Theme.of(context).textTheme.bodySmall,
    name: 'en_UK',
    decoration: textFormFieldDecoration(
        context, 'Test en_UK'),
    initialDate: DateTime.now(),
    initialTime: TimeOfDay.now(),
    onChanged: (value) {},
    locale: Locale('en', 'UK'),
  ),
),

Using my default Location as pt_PT
image
Introduza uma hora válida = Enter a valid time

Meanwhile specifying locale as us_UK:
image
It display's the AM/PM selector, so I can use 12Hrs format and select if it AM/PM

Aditional information

No response

@GuikiPT GuikiPT added the bug Something isn't working label May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant