-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Nullable DatePicker (make Date, MinimumDate & MaximumDate nullable) #27921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Feb 20, 2025
This comment was marked as outdated.
This comment was marked as outdated.
0b24f7e
to
440121e
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
de61f8b
to
0adeaed
Compare
This comment was marked as off-topic.
This comment was marked as off-topic.
0adeaed
to
d971c7c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request implements nullable support for the DatePicker properties in the core controls by transitioning Date, MinimumDate, and MaximumDate from non-nullable to nullable types.
- Updated DatePicker properties and associated BindableProperties in DatePicker.cs and IDatePicker.cs.
- Adapted platform renderers (Android, iOS, Windows) and handlers to handle nullable dates correctly.
- Adjusted unit tests and PublicAPI documentation to reflect the changes.
Reviewed Changes
Copilot reviewed 37 out of 39 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
src/Core/src/Handlers/DatePicker/DatePickerHandler.Android.cs | Updated nullable handling in dialog creation and event attachment. |
src/Core/src/Core/IDatePicker.cs | Modified DatePicker interface to use nullable DateTime properties. |
src/Controls/tests/… | Updated unit tests to validate nullable date behavior. |
src/Controls/src/Core/DatePicker/DatePicker.cs | Converted bindable properties and coercion/validation logic to work with DateTime? |
src/Compatiblity/…/DatePickerRenderer.cs (iOS/Windows/Android) | Adjusted renderers to safely handle nullable dates and update formatting. |
PublicAPI.Unshipped.txt files | Updated API surface descriptions to reflect the nullable changes. |
Files not reviewed (2)
- src/Controls/docs/Microsoft.Maui.Controls/DateChangedEventArgs.xml: Language not supported
- src/Controls/samples/Controls.Sample/Pages/Controls/DatePickerPage.xaml: Language not supported
dfe03f0
to
176768e
Compare
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jfversluis
commented
Apr 22, 2025
src/Compatibility/Core/src/Android/Renderers/DatePickerRenderer.cs
Outdated
Show resolved
Hide resolved
rmarinho
approved these changes
Apr 29, 2025
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of Change
The long awaited feature of making the
Date
,MinimumDate
, andMaximumDate
properties of theDatePicker
class nullable has been implemented!Changes
DateTime DatePicker.Date
->DateTime? DatePicker.Date
DateTime DatePicker.MaximumDate
->DateTime? DatePicker.MaximumDate
DateTime DatePicker.MinimumDate
->DateTime? DatePicker.MinimumDate
In #1100 it is proposed to also make the type
DateOnly
, while I like that, unfortunately that type is not available in netstandard so that would cause a lot of duplication of code and not great APIs and might even just be impossible because of that to make the XAML parsing and design time tooling work.Instead, I think we should take #21989 in addition to this to still allow people to use
DateOnly
(andTimeOnly
).Issues Fixed
Contributes to #1100 (
TimePicker
PR in #27930)