From ff4808d00a8c484245cecf29262d6f43bd3e67cc Mon Sep 17 00:00:00 2001 From: Daniel Chalmers Date: Sat, 11 Jul 2026 07:34:54 -0500 Subject: [PATCH 1/2] Accept countdown target dates in the user's locale The target text box used WPF's default en-US element language for its date conversion, so a non-US user typing a date in their own format (e.g. 25.12.2026) had it silently rejected on focus loss - while the preset captions and preview right beside it render dates in the OS locale, teaching exactly the format the box wouldn't accept. Set the editor's Language from the current culture so input and display match the rest of the UI. --- DesktopClock/CountdownTargetEditor.xaml.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DesktopClock/CountdownTargetEditor.xaml.cs b/DesktopClock/CountdownTargetEditor.xaml.cs index f5f556b..c4c1bcf 100644 --- a/DesktopClock/CountdownTargetEditor.xaml.cs +++ b/DesktopClock/CountdownTargetEditor.xaml.cs @@ -1,7 +1,9 @@ using System; using System.ComponentModel; +using System.Globalization; using System.Windows; using System.Windows.Controls; +using System.Windows.Markup; using DesktopClock.Properties; using Humanizer; @@ -27,6 +29,9 @@ public CountdownTargetEditor() { InitializeComponent(); + // WPF defaults every element's Language to en-US, so the target text box would parse and show dates only in US format. Follow the OS locale instead, matching the preset captions and preview below it. + Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag); + Loaded += CountdownTargetEditor_Loaded; Unloaded += (_, _) => Settings.Default.PropertyChanged -= Settings_PropertyChanged; } From dfe26996af421a80a45c2dc7043e7a641fd5dbe8 Mon Sep 17 00:00:00 2001 From: Daniel Chalmers Date: Sat, 11 Jul 2026 07:45:06 -0500 Subject: [PATCH 2/2] Set the culture before the bindings are created The initial binding transfer happens at load time so the display was already correct, but ordering the Language assignment before InitializeComponent means correctness doesn't depend on that timing. --- DesktopClock/CountdownTargetEditor.xaml.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DesktopClock/CountdownTargetEditor.xaml.cs b/DesktopClock/CountdownTargetEditor.xaml.cs index c4c1bcf..f52bca4 100644 --- a/DesktopClock/CountdownTargetEditor.xaml.cs +++ b/DesktopClock/CountdownTargetEditor.xaml.cs @@ -27,11 +27,11 @@ private static readonly (string Name, Func GetTarget)[] Presets = public CountdownTargetEditor() { - InitializeComponent(); - - // WPF defaults every element's Language to en-US, so the target text box would parse and show dates only in US format. Follow the OS locale instead, matching the preset captions and preview below it. + // WPF defaults every element's Language to en-US, so the target text box would parse and show dates only in US format. Follow the OS locale instead, matching the preset captions and preview below it. Set before InitializeComponent so the culture is already in place when the bindings are created. Language = XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag); + InitializeComponent(); + Loaded += CountdownTargetEditor_Loaded; Unloaded += (_, _) => Settings.Default.PropertyChanged -= Settings_PropertyChanged; }