I modified the field_timestamp.inc file to allow for a wider variety of dates (years before 1970 as well). Now, if I post a node with a date before 1970, the node view and flexinode table and list views of the node display the date as 1970-01-01, but the trip_search results page returns the dates correctly. From this I gather that the problem is in the flexinode code.

note: I also patched my Drupal installation with the adodb_time functions, and changed the relevant date functions in field_timestamp.inc.

What to do to be able to use dates before 1970 in timestamp fields and have them displayed correctly?

Thanks.

CommentFileSizeAuthor
#5 svn_diff2.3 KBsjs

Comments

magnestyuk’s picture

I rechecked and if I submit dates before 1970, the data is not inserted into the database, with or without the adodb_ functions.

Why the trip_search pages return the submitted dates correctly I have no idea of...

dtan’s picture

unix timestamps are integers based on the epoch which Jan 1, 1970, meaning that if you represent a date by 0, you will get the epoch. Anything before will be negative. As I see it there are 2 options, rewrite the flexinode_timestamp.inc to function with older dates (maybe serialize the data like profile.module does?), or create a new field type altogether.

samwilson’s picture

Has there been any progress on this, do you know? I need to be able to put in dates that go back to about 1615…

Bèr Kessels’s picture

please provide a patch for this.

sjs’s picture

StatusFileSize
new2.3 KB

I solved the problem in 4.7 by butting adodb date library at includes/; setting "alter table flexinode_data MODIFY numeric_data BIGINT DEFAULT 0 NOT NULL;", and making some changes to field_timestamp.inc and includes/common.inc (see the included svn diff)

Bèr Kessels’s picture

Version: 4.6.x-1.x-dev » master
Status: Active » Needs work

Your code is very unsafe. It allows SQL injection!