I tried to key the timeline view off a date-range field (date.module & API), which has a start-date and an end-date.

Horizontal Timeline is picking up the end-date just fine, but the start-date is defaulting to Wed, 31 Dec 1969 23:59:59 GMT for each and every node ... :(

Vertical Timeline seems to be picking up nothing at all (no blue bars or node info displayed).

any suggestions?

CommentFileSizeAuthor
#12 timeline.patch6.25 KBkarens
#6 timeline_daterange.patch2.19 KBjmiccolis

Comments

Arto’s picture

By API do you mean the ADOdb Date/Time library? If you do have the library installed, you may still be the very first one to ever try using the CCK date field + timeline on Drupal 5.x, so it could be just a simple problem that is quickly fixed. Jeff (the 5.x branch maintainer) may be able to help you out further.

As for the vertical timeline display, there is a known problem with that. Indications at present are that it needs to be fixed upstream in the SIMILE widget itself. I will add a warning about it to the README.txt.

Arto’s picture

Title: CCK date-range field (date.module) » Support the CCK date range field
Category: support » feature

Hmm, on closer examination, you said date-range field. I'm not sure anyone's tried that before. The module has so far been used with two separate CCK date fields, one for the start date and one for the end date. In other words, it's probably not going to work as is. Changing this to a feature request.

JohnG-1’s picture

Thanks Arto

These references might be useful to anyone clever enough to understand the code:

  1. KarenS's handbook notes on date.module's date-range object structure as accessed through theme_date_display_combination.
  2. A working example can be found in calendar.module (link to CVS). The function calendar_build_field_query has a section dealing with fromto formatted date fields ... around line 1083; wordsearch string: "handling for from and to date ranges".
jmiccolis’s picture

Assigned: Unassigned » jmiccolis

JohnG, this is on my list to take a look at. Hopefully I'll be able to take a crack at this soon, it should be reasonably straight forward to implement.

JohnG-1’s picture

@ jmiccolis
Great! :) Please let me know if I can help with testing / review ... or if I can help with anything for that matter :)

jmiccolis’s picture

Status: Active » Needs review
StatusFileSize
new2.19 KB

Attached is a patch that provides date module end-date support. I would appreciate any feedback / testing.

JohnG-1’s picture

@ #6 timeline_daterange.patch
I've applied this on my test site (not a clean install... but all new views, date, cck, etc modules) but I'm having problems :(
I'm using a single D-ranged datestamp field for the daterange. The order of the fields in the view seem to have a major effect ... but I can't find a combination that gives the desired result ... what should the view field order be ?

case 1
view field order = daterange / title / none / none
... timeline displays nothing at all.

case 2
view field order = daterange / daterange / title / none
... timeline displays correct title
... timeline displays only $start-date as a point (not a block) perhaps because $start_field & $end_field have the same value ?

case 3
view field order = title / daterange / none / none
... timeline displays correct title
... timeline displays a block representing the period from Wed, 31 Dec 1969 23:59:59 GMT to $start-date.

case 4
view field order = title / daterange / daterange / none
... timeline displays the $start-date as title
... timeline displays a block representing the period from Wed, 31 Dec 1969 23:59:59 GMT to $start-date.

for reference: README.txt says

The module supports plotting nodes on a timeline view using any date/time
field. It uses the views fields configuration to determine which field to
use for plotting the node as an event on the timeline. If fields have been
specified for the view, they are used as follows:
- 1st: If present, used as the start time for the timeline event. If not
  present, the node's creation time is used instead.
- 2nd: If present, used as the end time for the timeline event. If not
  present, the event will have no duration and will show up on the timeline
  as a point instead of as a block.
- 3rd: If present, used as the title and clickable link for the timeline
  event. If not present, the node's default title is used instead.
- 4th: If present, used as the description for the timeline event. If not
  present, the node's teaser is used (if available). NOTE: at present CCK
  nodes don't have a teaser by default, so you'll want to define the
  description field explicitly for them.
- Any other view fields are ignored by this module.

Timeline events with only a start date are displayed as points on the
timeline view, whilst events with both a start and date are displayed as
continuous colored blocks (not dissimilar to Gantt chart entries).
jmiccolis’s picture

JohnG - I realize I should have posted a couple more details with my patch. Because the end date is included in the field the date module provides the other stuff is bumped up, i.e. field 1 is the date-range, field 2 (if available) is the title & field 3 (if available) is the body. I realize that this is different than what is in the readme, but it seems to make the most sense.

Getting to you real issues - it's troubling that the timeline doesn't show up with your first & second case - can you try removing the title (so you just have one field that is the date module field) and see if that works?

Also what version of the date module are you using?

The last two cases you posted behave as I would expect them to. In both cases the timeline is trying to use the title as a start date (and failing so you get the item starting at unix 0 time) and because of way the date module field works it's using the date module from as the end time. The third and fourth field are behaving correctly.

JohnG-1’s picture

thanks for clarification jmiccolis

date.module // $Id: date.module,v 1.32.2.40 2007/04/19 20:35:25 karens Exp $ ... that's the 5.x-1.x-dev downloaded today

case 5
view field order = daterange / none / none / none
... timeline displays correct title
... timeline displays only $start-date as a point (not a block)

jmiccolis’s picture

Status: Needs review » Needs work

I think I know whats going on here - I was testing with a content type that used the date module supplied "date" field, as opposed to the "datestamp" which you are using. I've just tested with a "datestamp" field and I can confim that it doesn't work.

I'll need to update the patch to provide support for that field type.

JohnG-1’s picture

I'm having the same problem with iso date fields ...

karens’s picture

Status: Needs work » Needs review
StatusFileSize
new6.25 KB

I worked up a patch to get this all working since I needed a timeline with historical CCK dates. I changed the way things are done a bit so that you just use 3 fields in the view -- the date field, the title, and the body. For both Events and CCK dates, you can get both the start and end date from the same field, so there is no need to enter 2 date fields. This reduces the number of joins and the size of the query which should help efficiency.

In addition to that, I changed the logic a bit to check 'isset' instead of '!empty' on the item values, since I ran into problems on queries that had empty date fields in the first item returned by the query. The original method would use the node created date instead of my date field if the first item had an empty value. By checking isset instead, you can be sure the module is pulling the right data from the query results, and empty date fields just get thrown out.

I also changed the README text to reflect the new method.

I tested this with event fields and CCK date fields. I didn't test CCK datestamp fields, but only saw one place a change would be needed to get that working (use adodb to convert the timestamp value so historical timestamp fields are converted correctly) so they *should* work.

karens’s picture

Did some more testing and found something interesting I never realized before. If you use a CCK datestamp field and try to create a very old date (before 1901) the value you create is too big to be stored as an INT field and will be truncated to a date in 1901. To store that old date you need a BIGINT field instead. The Date module doesn't use the BIGINT field now, and I'm not sure it should, so if you want to do very old historical dates using the Date module, you should use the ISO format instead.

karens’s picture

If anyone is interested, I have a live working 5.x version of Timeline using CCK Date fields embedded in a book page at http://www.elderweb.com/home/node/9672.

jmiccolis’s picture

@Karen, Thanks for the patch!

@JohnG, as you reported this - please confim that Karen's patch works for you, and I'll commit it.

JohnG-1’s picture

Yay! this works for me on ISO date-range fields (but not UNIX datestamp ranges).

As Karen points out, datestamps can be a bit restrictive anyway; so I'm happy enough to use ISOs and leave datestamps un-supported.

... I vote commit this patch and put datestamp-ranges on the To Do list ;-)

Many thanks to both of you
:-J

jmiccolis’s picture

Status: Needs review » Needs work

Karen, I really do want to see date module support in timeline, however it seems like your patch removes support for event module end dates. People, including myself, are using the event module with timeline, so I can't commit this patch if it removes event module support.

karens’s picture

It does not remove support for event module end dates, it just removes the need to add both the start and end dates which makes the query simpler and faster. Both the start and end dates are available from either the start or end date, so you only need to add one of them and the code will pick up the other.

jmiccolis’s picture

Status: Needs work » Fixed

Thanks for the clarification, this has been committed.

Anonymous’s picture

Status: Fixed » Closed (fixed)