Dates prior to 1902 are not working

Date like 1/1/1902 works
Date like 1/1/1901 or before does not work .. does not show up in the node, and when I re-edit the value I entered disappeared. I go check the mysql database, I find that the field is still NULL!! I also tried editing the field manually from within phpmyAdmin and entering an old date, then I return to the node - still no data!

1) The type of field: date
2) The type of widget: text
3) The timezone option being used: no timezone conversion
4) Whether you are using the 'multiple' option: No
5) Whether you are using the 'required' option: No

I have to add and STRESS that I included the adodb-time library in the date module directory. I REPEAT that I included the adodb library.

Comments

bassio’s picture

Category: bug » support

Anyone update or help on this issue of mine?

karens’s picture

The key thing about 1902 is that is the oldest value you can store in a 32-bit field. This affects both the way the date is stored in the database and the way PHP handles it. You cannot store a date earlier than 1902 as a timestamp in an INTEGER field because the field is not big enough to store it. That would affect the datestamp field but should not affect a date field (since the ISO date doesn't have that problem).

The other effect of the 32-bit limitation is that standard PHP date(), gmdate(), mkdate(), etc functions, won't work for dates earlier than 1902, even in PHP 5 which has improved date handling. ADODB has some work-arounds for that and PHP 5's new date_create(), date_modify(), etc. functions also work around that problem.

Anyway, if things older than 1902 aren't working, it's most likely that the value is getting trapped by date() or related function somewhere, which can really only be if for some reason your program is not finding ADODB and is resorting to native date functions. Test whether your file is actually getting included by putting something right at the top of it to print() something on your page. If that never shows up, the file is not being found and the question is why. If it is found and you still are having dates cut off, it is something else.

I'm getting around this kind of problem in the 5.2 version of the module by using the native PHP 5 functions where they work, and some built-in wrapper code where they won't -- no more need to use the ADODB file.

bassio’s picture

Version: 5.x-1.6 » 5.x-1.x-dev
Category: support » bug

Thanks KarenS

However, I want to tell you that after I surrendered and I tried tracing the problem all the way I can. I could not find what was the problem.

But to my luck, I discovered that I was working with the 1.x-dev version - so I just downloaded the 1.6 version and bump .. it worked.

So check the new dev version again, maybe there is something going on in there.

I will just convert this into a bug report in case you want to be reminded of the issue.

I hope it is only a coincidental case and not the rule.

PS. I was using date and not datestamp.

karens’s picture

Status: Active » Postponed (maintainer needs more info)

I absolutely cannot replicate this. I can create old dates in the dev version in both PHP4 and PHP5. Can anyone else see problems? If so, provide as much info as possible about the way the date is set up.

karens’s picture

Status: Postponed (maintainer needs more info) » Fixed

If this is still a problem it should be fixed in the 5.2 version, which is not quite ready for an official release. You can see that release if you look for 'other releases' on the project page. Try it in a test environment, or be prepared to update it as bugs are found and fixed.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.