Datepicker attribute only shows 1960-1980 and defaults to 01-01-1970

Permalink
Hi all,

I have strange issue where I print an event date using a date/time attribute and it seems to default to 01-01-1970. Upon closer inspection I see that the date/time picker only gives me a year choice between 1960-1980 so there is obviously something wrong with my setup.

I have set the following in the config/site.php

define('APP_TIMEZONE', 'Australia/Melbourne');
define('DATE_APP_GENERIC_MDY', 'd.m.Y');
define('DATE_APP_GENERIC_MDYT_FULL', 'd.m.Y H:i:s');
define('DATE_APP_GENERIC_MDYT', 'd.m.Y H:i:s');
define('DATE_APP_DATE_PICKER', 'dd.mm.yy');


Any help would be greatly appreciated.

 
Remo replied on at Permalink Reply
Remo
the year choice is dynamic, 60-80 is most likely because the selected year is right in the middle, 70.

If you initialize the datepicker with a "0" you'll probably get that date since it's the start of the unix time. For quite a few applications 1-1-1970 means "no date". That's certainly a bit counter-intuitive but it's the way it is.

I doubt it's because of the configuration you've made. However, to be sure I'd recommend to comment all the constants you've posted. If it doesn't change anything, you know the problem is probably located somewhere else.

If that's the case, can you explain where exactly it fails? What screen, what object...
roby82 replied on at Permalink Reply
Same issue. Not a problema of configuration, it's a problem of jquery date picker, it does not save correctly day and month, it inverts these two values, so for example if you want to put:

31 January 2013 it saves in the database 01.01.1970 because for it it doesn't exists a date

where 31 is the month.

Yes maybe a configuration of the local, where we put for example day - month instead of month - day

but date picker show us these control forms where we can put these values in correct way.

I'm right now trying to solve and looking up the behaviour of date picker and the point of elaboration of the date.
Remo replied on at Permalink Reply
Remo
this PR fixes a few date picker issueshttps://github.com/concrete5/concrete5/pull/1782...
Maybe it helps in your case too
roby82 replied on at Permalink Reply
Hi Remo!
Good news for me ! :)

Thank for your reply, after searching in this forum and on the web I resolved by my self simply defining on my site.php :

(/config/site.php)

define('DATE_APP_DATE_PICKER', 'yy-m-d');
define('DATE_FORM_HELPER_FORMAT_HOUR', '24');
define('SITE_LOCALE', 'it_IT');


So:

Date picker shows me calendar, let me choose the correct data (also a data of a years ago, I'm importing old blog posts) and prints in the little field the data in format of local that I defined, but saves it in the format of yy-m-d, the format of SQL field in the table.

Finally seems it works good, reading and writing dates :)

Bye :)