fixed non-working format conversion for non-English month names #109
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.
This is my attempt to fix the following issue: Date/Time cleared when saving post
With these changes it works for me to enter dates formatted using German language month names, e.g. "03. März 2017 14:30"
I didn't test any other languages, but in theory it should work for every language.
Please note that to work properly, I had to set the PHP locale globally to "de_DE.UTF8" in the wp-config.php:
setlocale( LC_ALL, 'de_DE.UTF8' );
I didn't find a way to do this dynamically in the plugin code, and I'm not sure whether it's a general issue or depending on local PHP configuration. Without setting the UTF8 locale explicitly, the date conversion didn't work for me when the string contained non-ASCII characters (like the "ä" in "März").