Follow

Is there a way to set the timeline to the `date` closest to now?

On load, I'd like to start the timeline on something near now. Without having to process the JSON to try to know which slide index I should be pointing to. Possible?

Was this article helpful?
1 out of 2 found this helpful
Have more questions? Submit a request

9 Comments

  • 0
    Avatar
    Joe Germuska

    For now, Timeline only supports specific slide numbers. From your question, I'm assuming that your timeline has events both in the past and the future.

    I think it would be hard to make a clear choice about how to interpret "closest to now" for all users. I suppose one could have options for "first before now" and "first after now."

    I'm also not sure if Timeline could be decisive about slides that are meant to represent an entire month or year -- many users of the Google Spreadsheets, especially, use the feature explained in the FAQ as "If the event is on the first day of the month and no time is specified it shows only the month. The same is true for year. If the event date is the first day of the first month of the year, it only shows the year."

    We'll make note of it as a feature to-be-desired, but TimelineJS is currently in a maintenance mode, not an add-new-features mode, so i don't want to get your hopes up.

  • 0
    Avatar
    Kira Dayco

    Hi, I have the same question, but would be happy to set it manually to a certain slide (the most current/relevant one) if it's not possible to automatically set it to "closest to now". It sounds like this is possible since you reference specific slide numbers. How do I get the timeline to load to a specific slide so that users can navigate backwards or forwards from there? (current it defaults to the first (earliest) post from several years ago. Thanks!

  • 0
    Avatar
    Joe Germuska

    Kira:

    Sorry if my answer wasn't clear. Are you using the Timeline JS authoring tool at http://timeline.knightlab.com? If so, there is an option there for setting the starting slide number.

     

    Pasted_Image_3_17_14__9_48_AM.png

  • 0
    Avatar
    Jasper van Naarden

    I think what he ment and what I am also trying to find is a way that he shows the most recent news item and not a specific slide

  • 0
    Avatar
    Joe Germuska

    Jasper: I believe you are correct, regarding the first question. As noted, this is not something that TimelineJS currently supports. 

     

  • 0
    Avatar
    Kira Dayco

    Hi Joe, yes I have what I need now. I just needed some more detailed support around how to add the start_at_slide piece in WordPress as I was modified a timeline that some else had originally created. Setting the slide manually works for what I need. Thanks!

  • 0
    Avatar
    Jason Radovan

    If you are using google spreadsheets as your data source (I'm not sure of other sources since I am using GSS), you can apply the formula "=TODAY()" to a specific cell to return the specific date. There are other time options here: https://support.google.com/drive/answer/3092984

  • 0
    Avatar
    Jason Radovan

    I've attached a screenshot of my google spreadsheet to show what I'm talking about

  • 0
    Avatar
    Thomas Eitzenberger

    you can do so using the following method as start point. Afterwards you need to issue a window.location.reload(). Not the most sophisticated solution but a workaround until an appropriate API is avail

     

    br

    Thomas

     

    function go2Time(month,year) {

        var model = VMM.Timeline.DataObj.data_template_obj.timeline.date;

        var x = -1; //

        for (var i = 0; i < model.length; i++) {

          var j = model[i];

          var currentDate = j.startDate.split('/');

          if (currentDate[2] == year) {

            if (currentDate[0] == month ) {

              x++;

              if (x == 0) {

                window.location.hash = i+1; // +1 to accommodate title slide count

              }

            }

          }

        }

      }

Please sign in to leave a comment.
Powered by Zendesk