Skip to content

Derive default date/time formats from user profile language#401

Draft
w-ahmad with Copilot wants to merge 2 commits into
mainfrom
copilot/derive-default-date-time-formats
Draft

Derive default date/time formats from user profile language#401
w-ahmad with Copilot wants to merge 2 commits into
mainfrom
copilot/derive-default-date-time-formats

Conversation

Copilot AI commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

TableViewDateColumn and TableViewTimeColumn were resolving default formats from the app runtime language (set in Package.appxmanifest), causing users to see formats like MM/dd/yyyy and 12-hour clock even when their Windows language settings specified otherwise.

Changes

  • TableViewTimeColumn: Default ClockIdentifier now reads from GlobalizationPreferences.Clocks[0] instead of DateTimeFormatter.LongTime.Clock, with fallback to "24HourClock".
  • TableViewDateColumn: Added constructor that resolves the locale-aware short date pattern via new DateTimeFormatter("shortdate", GlobalizationPreferences.Languages).Patterns[0], with fallback to "shortdate".
  • TableViewTimeColumnTests: Updated default ClockIdentifier assertion to match new logic.
// Before — app runtime language
ClockIdentifier = DateTimeFormatter.LongTime.Clock;
DateFormat = "shortdate"; // DP default, resolved by WinRT using app language

// After — user profile language
var clocks = GlobalizationPreferences.Clocks;
ClockIdentifier = clocks.Count > 0 ? clocks[0] : "24HourClock";

var languages = GlobalizationPreferences.Languages;
var patterns = languages.Count > 0 ? new DateTimeFormatter("shortdate", languages).Patterns : null;
DateFormat = patterns?.Count > 0 ? patterns[0] : "shortdate";

A German user with de-DE in Windows Settings → Language will now see dd.MM.yyyy and 24-hour times regardless of the app's manifest default language.

Copilot AI changed the title [WIP] Update date and time formats based on user profile language Derive default date/time formats from user profile language Jul 5, 2026
Copilot AI requested a review from w-ahmad July 5, 2026 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Derive default formats for dates and times from user profile language

2 participants