Accept countdown target dates in the user's locale#151
Merged
Conversation
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The countdown Custom target text box binds a
DateTimewith noConverterCulture, so WPF uses the element'sLanguage— which defaults to en-US for every WPF element regardless of the OS locale. A German or French user who types a date in their own format (e.g.25.12.2026 18:00) gets it silently rejected on focus loss: no error, the value just doesn't change.It's made worse by the surrounding UI: the preset captions ("Sat, Jul 12, 9:00 AM") and the plain-words preview below the box both render in the OS locale, so the user is shown dates in exactly the format the box refuses to parse.
Fixed by setting the editor's
LanguagefromCultureInfo.CurrentCulturein the constructor. BecauseLanguageinherits down the visual tree, the target text box now parses and displays dates in the user's locale, consistent with the captions and preview. On an en-US machine nothing changes.