Skip to content

[WinUI] Fix DateTimeFormatter for "ddd"#20045

Merged
mattleibow merged 2 commits into
dotnet:mainfrom
drasticactions:dev/timill/datetimefix
Jun 8, 2024
Merged

[WinUI] Fix DateTimeFormatter for "ddd"#20045
mattleibow merged 2 commits into
dotnet:mainfrom
drasticactions:dev/timill/datetimefix

Conversation

@drasticactions
Copy link
Copy Markdown
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

@drasticactions drasticactions requested a review from a team as a code owner January 21, 2024 17:13
[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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

/rebase

@github-actions github-actions Bot force-pushed the dev/timill/datetimefix branch from 7ffccfe to 52b9fd8 Compare June 6, 2024 16:46
@mattleibow
Copy link
Copy Markdown
Member

/rebase

@github-actions github-actions Bot force-pushed the dev/timill/datetimefix branch from 52b9fd8 to 6f4ed24 Compare June 7, 2024 19:08
@mattleibow mattleibow merged commit 4480349 into dotnet:main Jun 8, 2024
@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