WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

Inconsistent UWP DateTimeFormatter output for similar patterns with en-US culture

Open hemapriya-gv-17087 opened this issue 7 months ago • 3 comments

I'm using Windows.Globalization.DateTimeFormatting.DateTimeFormatter in a UWP app with the culture set to "en-US". I noticed inconsistent formatting between two similar patterns.

Scenario: Pattern: "day month.abbreviated year hour minute" → Output: 03-Jun-25 10:53 AM

Pattern: "day month.abbreviated hour minute" → Output: Jun 3 10:53 AM

Despite both using "day" and "month.abbreviated", the order of components differs depending on whether year is included or not.

Expectation: Both formats should follow a consistent order like MM/dd/yyyy for a given culture ("en-US" in this case).

Ways to Reproduce:

string format1 = "day month.abbreviated year hour minute";
string format2 = "day month.abbreviated hour minute"
DateTimeFormatter formatter1 = new DateTimeFormatter(format1 , new[] { "en-US" });
DateTimeFormatter formatter2 = new DateTimeFormatter(format2 , new[] { "en-US" });
var output1 = formatter1.Format(DateTime.Now);
var output2 = formatter2.Format(DateTime.Now);

hemapriya-gv-17087 avatar Jun 04 '25 07:06 hemapriya-gv-17087

UWPs/CoreWindows are not supported by WASDK. Is this issue reproducible in any generic win32 app? (hwnd, winforms, wpf, WinUI3)?

This is reproducible in WinUI3 since the DateTimeFormatter is a WinRT API

hemapriya-gv-17087 avatar Jun 13 '25 10:06 hemapriya-gv-17087

We appreciate your input. Since this relates to UWP and the Windows App SDK targets desktop-based project types, we’ll close this issue as not planned. For guidance on migrating from UWP to Windows App SDK, see: https://learn.microsoft.com/windows/apps/windows-app-sdk/migrate-to-windows-app-sdk/migrate-to-windows-app-sdk-ovw

ssparach avatar Oct 17 '25 23:10 ssparach