Skip to content

DatePicker handles firstDate incorrectly, does not let respective day be selected #44045

Closed
@sceee

Description

@sceee

Steps to Reproduce

  1. Set myInitialDate to a Date representing 2019-11-03 15:00:00.000
  2. Set `earliestDateToBePicked to a Date representing 2019-11-02 14:41:20.807952
  3. Set latestDateToBePicked to a Date representing 2019-11-03 23:59:59.000
  4. Use a DatePicker that is set up with the following code
    final DateTime picked = await showDatePicker(
      context: context,
      initialDate: _myInitialDate,
      firstDate: earliestDateToBePicked,
      lastDate: latestDateToBePicked,
    );
  1. Execute the code, opens the DatePicker
  2. In the DatePicker (both on iOS and Android), todays day (Saturday, 2019-11-02) cannot be selected even though it is set as firstDate:
    Screenshot_20191102-124449

Additional information I noticed when playing around with other dates for the three input values:
If you set initialDate to the same value as firstDate (2019-11-02 14:41:20.807952), the DatePicker opens with todays date selected. But if you then select tomorrows day, todays day gets disabled immediately.

Target Platform: Android and iOS (Built on Windows / mac)
Target OS version/browser: It seems like all, definitely tested and reproduced on Android: 7, 9, iOS: 13
Devices: Many different, does occurr on simulator as well as on physical devices

Logs

I did not want to attach all my logs (since there is a lot of custom loggin inside) but nothing is logged at this specific location when executing showDatePicker, therefore I did not attach logs.
Analyzing App...
No issues found! (ran in 51.8s)
[√] Flutter (Channel stable, v1.9.1+hotfix.5, on Microsoft Windows [Version 10.0.18362.418], locale de-DE)
    • Flutter version 1.9.1+hotfix.5 at O:\Tools\flutter
    • Framework revision 1aedbb1835 (2 weeks ago), 2019-10-17 08:37:27 -0700
    • Engine revision b863200c37
    • Dart version 2.5.0

 
[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at O:\Libraries\androidsdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = O:\Libraries\androidsdk
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)
    • All Android licenses accepted.

[√] Android Studio (version 3.5)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 38.2.3
    • Dart plugin version 191.8423
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03)

[√] VS Code (version 1.39.2)
    • VS Code at C:\Users\.....\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.6.0

[√] Connected device (1 available)
    • STH100 2 • 1163801706 • android-arm64 • Android 6.0.1 (API 23)

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    a: qualityA truly polished experiencef: date/time pickerDate or time picker widgetsf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions