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

[WinUI] Fix DateTimeFormatter for "ddd" #20045

Merged
merged 2 commits into from
Jun 8, 2024

Conversation

drasticactions
Copy link
Contributor

Description of Change

The WinUI controller for DatePicker uses a CalendarDatePicker. That uses a special Windows Globalization format, which included the day and abbreviated day for ddd. Going by that doc, that's wrong. It should only be the abbreviated date.

Issues Fixed

Fixes #19967

@@ -12,7 +12,7 @@ public partial class DatePickerHandlerTests
[Theory(DisplayName = "Format Initializes Correctly")]
[InlineData("dd/MM/yyyy", "{day.integer(2)}/{month.integer(2)}/{year.full}")]
[InlineData("d/M/yy", "{day.integer}/{month.integer(1)}/{year.abbreviated}")]
[InlineData("ddd/MMM/yyyy", "{day.integer} {dayofweek.abbreviated}/{month.abbreviated}/{year.full}")]
[InlineData("ddd/MMM/yyyy", "{dayofweek.abbreviated}/{month.abbreviated}/{year.full}")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test previously passed with
[InlineData("ddd/MMM/yyyy", "{day.integer} {dayofweek.abbreviated}/{month.abbreviated}/{year.full}")]
?

Should we validate the resulting string as well or include a different test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test validates that the input string gets translated to the expected output, which should be what I changed it to here (hence why I did). So to validate the existing string, it would be a new test to validate that the previous string that was there ({day.integer} {dayofweek.abbreviated}) is incorrect, so we don't regress it when making changes.

I'm not sure how important that is, but I'm not against doing it.

@samhouts samhouts added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Jan 25, 2024
@Eilon Eilon added area-controls-datetimepicker DatePicker, TimePicker and removed legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor labels May 13, 2024
@mattleibow
Copy link
Member

/rebase

@mattleibow
Copy link
Member

/rebase

@mattleibow mattleibow merged commit 4480349 into dotnet:main Jun 8, 2024
49 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jul 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datepicker date format display incorrect in windows but ok on android
5 participants