Failed to parse time string

tali

Member
An old bug that is present in the current GitHub
Code:
0 DateTime::__construct(): Failed to parse time string (13/06/2016) at position 0 (1): Unexpected character
Call stack
#   Function   Location
1   JApplicationCms->execute()   index.php:49
2   JApplicationSite->doExecute()   libraries\cms\application\cms.php:257
3   JApplicationSite->dispatch()   libraries\cms\application\site.php:230
4   JComponentHelper::renderComponent()   libraries\cms\application\site.php:191
5   JComponentHelper::executeComponent()   libraries\cms\component\helper.php:380
6   require_once()   libraries\cms\component\helper.php:405
7   JControllerLegacy->execute()   components\com_fabrik\fabrik.php:181
8   FabrikControllerForm->display()   libraries\legacy\controller\legacy.php:728
9   JCacheControllerView->get()   components\com_fabrik\controllers\form.php:161
10   FabrikViewForm->display()   libraries\joomla\cache\controller\view.php:96
11   FabrikViewFormBase->display()   components\com_fabrik\views\form\view.html.php:37
12   FabrikFEModelForm->getGroupView()   components\com_fabrik\views\form\view.base.php:171
13   PlgFabrik_Element->preRender()   components\com_fabrik\models\form.php:4690
14   PlgFabrik_Element->preRenderElement()   components\com_fabrik\models\element.php:2151
15   PlgFabrik_ElementDate->getValue()   components\com_fabrik\models\element.php:2335
16   JFactory::getDate()   plugins\fabrik_element\date\date.php:1053
17   JDate->__construct()   libraries\joomla\factory.php:530
18   DateTime->__construct()   libraries\joomla\date\date.php:109

What is weird is that the problem is present only on 3 out of 8 datetime of the form.
Time is set to No
Changing the format from d/m/Y or d/m/y to Y-m-d didn't help.

And last, it appears only if the user is connected (J! 3.5.1)
Just to mention, that accesses (form and elements are all set to Public)
 
Last edited:
"only on 3 out of 8" and "appears only if the user is connected ": do you have some validations, calc elements, prefilters etc. only applied to logged in users?
 
Must have to do with date format.
When, in plugins\fabrik_element\date\date.php I add the line
Code:
if ($value=='13/06/16') $value='2016-06-13';
just before
Code:
$date  = JFactory::getDate($value, $timeZone);
it works.

This may give some hints to find out how to correct that.
 
Dates with / may have issue with Joomla's date (there are some other threads somewhere).

But you said
Changing the format from d/m/Y or d/m/y to Y-m-d didn't help.
so it doesn't seem to be the date format itself (Fabrik should use MySQL dates anyway, as far as I got it the formatting is done via JS).
I can't replicate the error.

So what are your exact settings of the failing elements?
"only on 3 out of 8" and "appears only if the user is connected ": do you have some validations, calc elements, prefilters etc. only applied to logged in users?
Is the error is list, form, details view?
 
Where is the date coming from? Is that a default, or something coming in from posted data on the form?

-- hugh
 
The problem was coming from the #__fabrik_form_sessions table.
Once I truncated that table, things became OK.

What I looked for, is where this date (the #table___datetime) '13/06/2016' came from, as I had no such a date in my tables.
It came from the #__fabrik_form_sessions table.
This is not usually a problem.

But, as far as I remember, between the time I began the form (probably on the 13th of June) and the time I continued the form, I changed the elements fabrik's format of some dates : I guess the 3 that showed the problem.

So it is most probable that fabrik cannot read correctly a date that was stored in a form session when the element format of this date has been changed meanwhile.

My suggestion is that the dates should be stored in the #__fabrik_form_sessions table in "2016-06-13" format and not "13\/06\/2016"
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top