Skip to content

DateRangePicker shows reverse date range when specifying more days between firstDate & lastDate than the previous number of days in the present month  #68784

@MiltoxBeyond

Description

@MiltoxBeyond

I created a simple prototype for work to show the benefits of flutter but I did notice the dateRangePicker is opening up to the wrong dates.

                              onTap: () async { 
                                    var result = await showDateRangePicker(
                                      context: context, 
                                      firstDate: DateTime.now().subtract(Duration(days:60)), 
                                      lastDate: DateTime.now(),
                                      initialEntryMode: DatePickerEntryMode.calendar,
                                      currentDate: DateTime.now(),
                                      initialDateRange: DateTimeRange(
                                        start: DateTime.now(), 
                                        end: DateTime.now()
                                      ),
                                    );
                                 }

This creates the dialog and modifying the initial range and first/last dates does everything as expected, except when it opens the dialog shows the first months closest to firstDate. It's fine with a few months but at first I set the firstDate to 10 years in the past, and that was quite the scroll to get to the current date:

Metadata

Metadata

Assignees

No one assigned

    Labels

    f: date/time pickerDate or time picker widgetsf: material designflutter/packages/flutter/material repository.found in release: 1.22Found to occur in 1.22frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions