Joomla 3.x on SQL -- blank date defaults to "1970"

279 views
Skip to first unread message

Adrian Rodriguez FSO

unread,
Jun 18, 2014, 1:18:09 PM6/18/14
to joomla-...@googlegroups.com
Hello,

Thank you all for continuing your work on this amazing software.

I've installed a J!3.3.1 instance using a Microsoft SQL server, and I've noticed a problem with saving items within Joomla on the front-end or back-end, related to the date fields.

This happens for any item, but let's use an Article as an example.

It seems that leaving a field such as "Finish Publishing" blank will result in the field being saved with "1900-01-01 00:00:00" in the database. This is expected for an SQL server.

However, when re-entering the same saved Article item, the field's tooltip reads "1900 Jan 1" but the actual value of the field says "1970-01-01 00:00:00." Upon saving this, the database cell is updated to the value "1970-01-01 00:00:00" and the article is listed as "expired" on the front end.

It seems that the database is receiving the correct value the first time, but somehow, the form that includes the datepicker is showing the value as 1970.

I realize that postgre databases use 1970, ms-sql uses 1900, and mysql uses 0000 for the "null" date. Can anyone help me figure out why the jform is showing the value of 1970, then?

I've searched everywhere and while I've usually found a patch for this type of thing in the past, I cannot find one in this case.

Thank you!

Bakual

unread,
Jun 18, 2014, 5:36:06 PM6/18/14
to joomla-...@googlegroups.com

Maybe we need to somehow check the null date there instead of just checking for a value. It may be a bit tricky to do. I don't know.

Michael Babker

unread,
Jun 18, 2014, 6:17:53 PM6/18/14
to joomla-...@googlegroups.com
If it's possible to do a check, you can use JFactory::getDbo()->getNullDate(); to get the driver specific null dates.


--
You received this message because you are subscribed to the Google Groups "Joomla! CMS Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-cm...@googlegroups.com.
To post to this group, send email to joomla-...@googlegroups.com.

Bakual

unread,
Jun 19, 2014, 4:05:54 AM6/19/14
to joomla-...@googlegroups.com
Thanks Michael! https://github.com/joomla/joomla-cms/pull/3803 now uses the database NullDate for the check.
@Adrian can you test the patch and give a feedback if it works or not?
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-cms+unsubscribe@googlegroups.com.
To post to this group, send email to joomla-dev-cms@googlegroups.com.

Adrian Rodriguez FSO

unread,
Jun 25, 2014, 4:41:40 PM6/25/14
to joomla-...@googlegroups.com
Thank you for this. It seems to have produced some progress, but another problem has arisen as a result.

I applied the patch at https://github.com/joomla/joomla-cms/pull/3803.

What happens now is that when I leave the "Finish Publishing" field blank, it stays blank. Upon hovering over the blank "Finish Publishing" field on the edit screen (back-end), it shows the value "Monday 01 January 1900." OK, that seems expected. However, when I leave this field blank for an article that is therefore listed as "Published and Current," it appears on the front end -- but is indicated to be "Expired." 

I can investigate further but I'm not sure where to look... this may be a new, unrelated problem, although it doesn't seem like it.

To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-cm...@googlegroups.com.
To post to this group, send email to joomla-...@googlegroups.com.

Bakual

unread,
Jun 25, 2014, 6:11:21 PM6/25/14
to joomla-...@googlegroups.com
Can you add your findings to the GitHub PR? That helps to keep the info organised.

That it stays blank is intentional, and how it currently behaves also for MySQL. The tooltip is indeed wrong as well. It also only checks for "(int) value". That should be easy to fix.
Where does it show as expired? In the backend?

Adrian Rodriguez FSO

unread,
Jul 1, 2014, 12:36:42 PM7/1/14
to joomla-...@googlegroups.com
OK, I've added this to the comment section of the pull request page on github, including an answer to your question!

The answer is: The "Expired" label is on the front end, and appears even when I'm a guest (not logged into the site in the front end). 

Bakual

unread,
Jul 1, 2014, 1:56:01 PM7/1/14
to joomla-...@googlegroups.com
Updated the PR ;)
Reply all
Reply to author
Forward
0 new messages