Skip to content
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

Fix for DatePicker displays incorrect date selection when navigating to next month. #26064

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

BagavathiPerumal
Copy link
Contributor

Root cause

The issue was caused by incorrect handling of the month parameter when creating the DatePickerDialog. The month value from VirtualView?.Date was passed directly to the CreateDatePickerDialog method without adjusting for the difference in month indexing between the .NET framework (1-based) and Android's DatePickerDialog (0-based). This mismatch resulted in an incorrect month being displayed when navigating between months in the dialog.

Description of Issue Fix

The fix involves adjusting the month value passed to the DatePickerDialog in the CreatePlatformView method by subtracting 1 from the DateTime.Month value. This ensures compatibility with Android's 0-based month indexing, while maintaining correct behavior with the .NET framework’s 1-based month indexing, allowing the date to display correctly when navigating between months.

Tested the behavior in the following platforms.

  • Windows
  • Android
  • iOS
  • Mac

Issues Fixed

Fixes #25943

Output

Before Issue Fix After Issue Fix
DatePicker-BeforeFix.mp4
DatePicker-AfterFix.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Nov 22, 2024
Copy link
Contributor

Hey there @BagavathiPerumal! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@BagavathiPerumal BagavathiPerumal marked this pull request as ready for review November 22, 2024 14:35
@BagavathiPerumal BagavathiPerumal requested a review from a team as a code owner November 22, 2024 14:35
@jsuarezruiz jsuarezruiz added the area-controls-datetimepicker DatePicker, TimePicker label Nov 22, 2024
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-datetimepicker DatePicker, TimePicker community ✨ Community Contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] DatePicker Graphical Bug
2 participants