From 4480349875084b441e77a3d584896f99f4c0407c Mon Sep 17 00:00:00 2001 From: Tim Miller Date: Sat, 8 Jun 2024 18:22:24 +0900 Subject: [PATCH] [WinUI] Fix DateTimeFormatter for "ddd" (#20045) * Update ddd DateTimeFormatter * Update test --- src/Compatibility/Core/src/Windows/DatePickerRenderer.cs | 2 +- src/Core/src/Platform/Windows/CalendarDatePickerExtensions.cs | 2 +- .../Handlers/DatePicker/DatePickerHandlerTests.Windows.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Compatibility/Core/src/Windows/DatePickerRenderer.cs b/src/Compatibility/Core/src/Windows/DatePickerRenderer.cs index dcec99e74879..3666eb0b178f 100644 --- a/src/Compatibility/Core/src/Windows/DatePickerRenderer.cs +++ b/src/Compatibility/Core/src/Windows/DatePickerRenderer.cs @@ -202,7 +202,7 @@ void UpdateDay() if (day == 0) Control.DayVisible = false; else if (day == 3) - Control.DayFormat = "day dayofweek.abbreviated"; + Control.DayFormat = "dayofweek.abbreviated"; else if (day == 4) Control.DayFormat = "dayofweek.full"; else diff --git a/src/Core/src/Platform/Windows/CalendarDatePickerExtensions.cs b/src/Core/src/Platform/Windows/CalendarDatePickerExtensions.cs index 5b6e60c4d3dc..2a7f60a1f37e 100644 --- a/src/Core/src/Platform/Windows/CalendarDatePickerExtensions.cs +++ b/src/Core/src/Platform/Windows/CalendarDatePickerExtensions.cs @@ -84,7 +84,7 @@ internal static string GetDayFormat(string format) var day = format.Count(x => x == 'd'); if (day == 3) - return "{day.integer} {dayofweek.abbreviated}"; + return "{dayofweek.abbreviated}"; else if (day == 4) return "{dayofweek.full}"; else diff --git a/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs b/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs index fea46b3b3c8e..3f63aa7c6596 100644 --- a/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs +++ b/src/Core/tests/DeviceTests/Handlers/DatePicker/DatePickerHandlerTests.Windows.cs @@ -48,7 +48,7 @@ public override async Task DisconnectHandlerDoesntCrash() [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}")] [InlineData("dddd/MMMM/yyyy", "{dayofweek.full}/{month.full}/{year.full}")] public async Task FormatInitializesCorrectly(string format, string nativeFormat) {