Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for wxDateTime and generic wxDatePickerCtrl date parsing #24541

Merged
merged 6 commits into from
May 19, 2024

Conversation

vadz
Copy link
Contributor

@vadz vadz commented May 17, 2024

This addresses #24533 and does some small extra cleanup.

Note that this doesn't add support for %E* and %O* as this is much more involved, as described there.

vadz added 6 commits May 17, 2024 16:22
Some locales use format specifiers not supported (yet) by
wxDateTime::Parse() and while the best fix is to add support for them,
as it has been already done for %F (see wxWidgets#24173) and will be done for
"%-" (see wxWidgets#24533) soon, it still seems wise to handle the locales for
which it still might happen, now or in the future, more gracefully by
falling back to ISO 8601 date format if the locale format can't be used
because we can't parse it.

Note that an alternative approach could consist in using the locale
format for formatting the dates and falling back to ISO 8601 only for
parsing them, but it would arguably be confusing to the user if the
program expected input in a format different from what it uses for
displaying the dates, so prefer just using the same format for both, if
we can't do otherwise.
Remove completely unnecessary DateTimeTestCase and use CHECK() instead
of CppUnit macros.
It wasn't very logical to have them in the same test case as the tests
for wxDateTime::Format().

No real changes.
This allows to use REQUIRE() for the tests which must not fail for the
subsequent tests in the same section to succeed.
This isn't the case any more since a long time, see 89a7e1f (Added
wxLOCALE_DATE/TIME_FMT support to wxLocale::GetInfo()., 2009-03-29).
This is not really used when parsing, but we still need to support the
GNU extensions to the strftime() formatting specifiers used to change
padding, as they can (and do, at least in the case of "%-d" and "%-m")
occur in the locale descriptions and so can be used when parsing dates
using the current locale format.

Closes wxWidgets#24533.
@vadz vadz merged commit 7d47bc0 into wxWidgets:master May 19, 2024
39 checks passed
@vadz vadz deleted the datectrl-parse-fixes branch May 19, 2024 18:50
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.

None yet

1 participant