Skip to content

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

Open
@GuikiPT

Description

@GuikiPT

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions