Skip to content
This repository was archived by the owner on May 1, 2024. It is now read-only.
This repository was archived by the owner on May 1, 2024. It is now read-only.

DatePicker MinimumDate/MaximumDate shouldn't be selectable #3048

Not planned
@MaxFe

Description

@MaxFe

Description

When MinimumDate is set to today and we choose yesterday, today will be chosen for DateProperty. It would be great when everything lower than MinimumDate couldn't be chosen at all (e.g. it wouldn't scroll to a date lower then MinimumDate). The same for MaximumDate. The current implementation could cause confusion. When the user chooses a date that is lower than MinimumDate the DateProperty will be magically set to today. Without giving feedback to the user.

Steps to Reproduce / Actual Behavior

MinimumDate was set to today.

  1. Open DatePicker and choose yesterday
  2. Click "Accept"
  3. Today will appear as DateProperty and will be shown

Expected Behavior

MinimumDate was set to today.
Solution: Open DatePicker and choose yesterday (that shouldn't be possible)
Optional solution: Click "Accept" (or it shouldn't be possible to click accept)

Basic Information

  • Version with issue: 2.5.1.527436
  • Last known good version: -
  • IDE: Visual Studio 15.7.3
  • Platform Target Frameworks:
    • UWP: 1803 (Build 17134.112)
    • Android and iOS: not tested

Activity

UnreachableCode

UnreachableCode commented on Jul 25, 2018

@UnreachableCode

I am facing a similar issue right now. While I'd like if a datepicker didn't allow the selection of days in the past, I still need it to show yesterday if it's set from another source, e.g. a database.

andreinitescu

andreinitescu commented on Nov 1, 2018

@andreinitescu
Contributor

It would be great when everything lower than MinimumDate couldn't be chosen at all (e.g. it wouldn't scroll to a date lower then MinimumDate)

The UWP control doesn't actually have a minimum date. It has only a MinYear: https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.datepicker.minyear
Same for maximum date, there's only a MaxYear property.
I think this is because of the way the native DatePicker control on UWP is designed, it has separate sliders for month, day, year.

Instead of using DatePicker on UWP, I think it would be better if the native control would be the CalendarView: https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Controls.CalendarView which supports setting minimum and maximum date.

On Android the renderer is actually a calendar which supports min/max dates. On iOS, the native control (UIDatePicker) also supports min/max dates.

It's up to the Xamarin Forms team to approve changing the UWP renderer to use the CalendarView

added
inactiveIssue is older than 6 months and needs to be retested
on Jul 4, 2019
JuanuMusic

JuanuMusic commented on Jul 1, 2020

@JuanuMusic

Update on current behavior that might need review:
ANDROID:
Minimum Date shows a calendar with only Dates from Minimum Date and TO Maximum Date.

IOS:
The picker lets you navigate to any date but when choosing one outside the range it selects the minimum or maximum.
Should the picker display only allowed dates?

removed
inactiveIssue is older than 6 months and needs to be retested
on Jul 17, 2020
jfversluis

jfversluis commented on Dec 7, 2023

@jfversluis
Member

Thanks for this suggestion! As Xamarin.Forms is now in maintenance mode, this will not happen anymore for Xamarin.Forms. We're only adding bugfixes and stability fixes.

If this is still important to you, make sure to check the .NET MAUI repo and see if it's already on the roadmap. If not, feel free to open a discussion to discuss a change first or open an issue with a detailed feature request. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Closed

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @andreinitescu@jfversluis@UnreachableCode@JuanuMusic@samhouts

        Issue actions

          DatePicker MinimumDate/MaximumDate shouldn't be selectable · Issue #3048 · xamarin/Xamarin.Forms