British/European getCollectionDatePublic problem

Permalink
Hi all

I've enabled British/European date formats by adding the following to site.php:

define('DATE_APP_GENERIC_MDYT_FULL', 'F d, Y \a\t g:i A');
define('DATE_APP_GENERIC_MDYT', 'j/n/Y \a\t g:i A');
define('DATE_APP_GENERIC_MDY', 'j/n/Y');


...which works fine in most places. I'm having trouble with Release Date though.

When I add a new news page, the Release Date (public date) doesn't get carried over to the editing interface. It is set correctly on the initial interface where the title and description is entered, but when I OK that and go to edit the content it reverts to 1 January 1970 (I know this because my news page pagetype displays $c->getCollectionDatePublic("j F Y") to show the date of a particular news item.

Any thoughts?

melat0nin
View Replies:
Mnkras replied on at Permalink Reply
Mnkras
in the install script i found
$pressRelease->setAttribute('Release_Date',date("Y-m-d H:i"));

looks like this is the problem:

concrete/models/attribute/types/date_time/controller.php


$value = date('Y-m-d H:i:s', strtotime($value));


Andrew can you fix this? in the meantime, you can change this manually by sticking in DATE_APP_GENERIC_MDYT_FULL

Mike
melat0nin replied on at Permalink Reply
melat0nin
That doesn't work alas (putting DATA_APP_GENERIC_MDYT_FULL into site.php), it still reverts to 1 January 1970 after creating the page :(
Mnkras replied on at Permalink Reply
Mnkras
nonono, stick it in that file i mentioned above
melat0nin replied on at Permalink Reply
melat0nin
It doesn't work, the date shown on the page in edit mode is still 1 January 1970, even though the Public Date in the Add Page dialogue is today :(
melat0nin replied on at Permalink Reply
melat0nin
Can anyone help?
andrew replied on at Permalink Reply
andrew
we'll look into this. I feel like we tackled this just recently when working with the German locale.
andrew replied on at Permalink Reply
andrew
Yes, this is fixed in svn and will be released soon. Basically the problem is in the date helper that assumes the format is a certain way, which causes it to get stuck when it assumes the format is m/d/Y, and it's actually d/m/Y.
losttheplot replied on at Permalink Reply
FYI, this is not totally fixed and I've just spent a day deciding that I cannot use define('DATE_APP_GENERIC_MDY','j/n/Y'); in my site config file.

The problem boils down to concrete/helpers/form/date_time.php (e.g. line 87) whereby c5 inserts the current datetime in the DATE_APP_GENERIC_MDY format, into the cDatePublic input of /composer/write.php. Unless the user knows that they *must* use the datepicker to correct the dt format (or make it incorrect if you're British), the dt will be corrupt and end up with a posting time of zero (1 Jan 1970).
PatrickHeck replied on at Permalink Reply
PatrickHeck
This should definitely be fixed in 5.6.3RC2 now.http://www.concrete5.org/documentation/background/version_history/5...
Best
Patrick
losttheplot replied on at Permalink Reply
Great, thanks. I've been using 5.6.2.2b2 so maybe I'll update :)