soderlind / acf-field-date-time-picker

Date and Time Picker field for Advanced Custom Fields v3 and v4
GNU General Public License v2.0
65 stars 27 forks source link

fixed non-working format conversion for non-English month names #109

Open sternhagel opened 7 years ago

sternhagel commented 7 years ago

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").

soderlind commented 7 years ago

Thank you. I'll test it locally before I do the merge.