Skip to content

Unexpected showDatePicker behavior when changing year #81547

@jjoelson

Description

@jjoelson

It's not clear if this is a bug or intended behavior, but at any rate the Flutter Material date picker has a behavior that differs from that of the native Android date picker in such a way that is likely to cause users accustomed to the native behavior to select the wrong date in a Flutter app.

Steps to Reproduce

  1. Open a date picker with showDatePicker with initialDate: DateTime(2021, 4, 30)
  2. Tap the year control and select 2015 (or any other year)

Expected results:

4/30/2015 ought to be the newly selected date i.e. the month/day in the newly selected year that corresponds to that of the previously selected date (or closest available).

Actual results:

The date picker displays April in 2015, but 4/30/2021 remains the selected date. If the user taps OK at this point intending to select 4/30/2015 then they will actually select 4/30/2021.

RPReplay_Final1619795575.MP4
Logs
[✓] Flutter (Channel stable, 2.0.3, on Mac OS X 10.15.7 19H1030 darwin-x64, locale en-US)
    • Flutter version 2.0.3 at /Users/jonathan.joelson/repos/flutter
    • Framework revision 4d7946a68d (6 weeks ago), 2021-03-18 17:24:33 -0700
    • Engine revision 3459eb2436
    • Dart version 2.12.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/jonathan.joelson/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • 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 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.55.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.21.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: date/time pickerDate or time picker widgetsf: material designflutter/packages/flutter/material repository.found in release: 2.5Found to occur in 2.5found in release: 2.6Found to occur in 2.6frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions