Open digicodexx opened 6 years ago
From WordPress.org Forums: https://wordpress.org/support/topic/failed-to-parse-time-string/ Thanks for creating the report @digicodexx !
What kind of content are you storing in the series date field?
۱۳۹۷-۰۲-۱۴
looks kind of weird as a date string, is that localized?
It looks like we've got two issues here:
It's a Persian string, and yes it is localized, (http://wp-persian.com) http://fa.wordpress.org/wordpress-4.9.1-fa_IR.zip, (upgradable to 4.9.5 via control panel).
The plugin responsible for Persian calendar is: https://wordpress.org/plugins/wp-jalali/. I've had no issues with other plugins so far.
For this, we might need to look into IntlDateFormatter http://php.net/manual/en/intldateformatter.format.php
Not sure exactly which configs have it, but it requires an additional PECL package installed/enabled for PHP.
I don't think even the IntlDateFormatter
accepts non-Latin input, which is what's required here.
I did find http://www.ar-php.org/, and one of the pages is to parse Arabic strings into DateTime objects.
The latest version is from 2016, and that parsing is made up of a couple of classes, and a couple of XML files - one of which translates, another which adds Hijri calendar corrections and so on.
I don't think though that this Arabic input is necessarily core functionality - what about support for adding Korean, or Japanese, or Chinese or Hebrew or Greek other non-Latin scripts as input? Each of the respective locales (and even some from locales with Latin scripts) may have their own calendar / datetime variations that differ from Gregorian calendar used in Western countries.
Pods core could certainly ensure that RTL scripts display correctly, but accepting localized values that are passed into to PHP core classes and functions is going to need a whole new section of code, or for it to be handled in a separate plugin.
I don't know if the JS datepicker has the ability to pick and display in Arabic but submit in English.
As a workaround, I save and retrieve Georgian dates. Then to display Jalali dates, I use the following code in the template:
{@event_start_date, jalali_date_full}
where jalali_date_full is a function saved in the child theme / code snippet plugin as follows:
function jalali_date_full($input_date) { return jdate("l، j F Y", strtotime($input_date)); }
But it would be nice to save Jalali dates, using a Jalali JavaScript datepicker.
Needs retesting on the latest React date field inputs that we have.
I’ve been having issues adding Date Post Types lately.
Steps to Reproduce (for bugs)
Just by simply adding a new CPT field.
Pods Package Export (helpful!)
WordPress Environment