Timeline.SpanHighlightDecorator({ startDate: startDate , endDate: endDate });
--
You received this message because you are subscribed to the Google Groups "SIMILE Widgets" group.
To post to this group, send email to simile-...@googlegroups.com.
To unsubscribe from this group, send email to simile-widget...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/simile-widgets?hl=en.
--
> Michael, another question for you if you don't mind:
>
> I'd like to define start/end time in the form: '2000-01-01' rather than just year. If I change format in the JSON source file, the timeline appears to hit an error while trying to parse it. So, I assumed that we needed to leverage the .parseGregorianDateTime function:
>
> var deco = new Timeline.SpanHighlightDecorator({
> startDate : Timeline.DateTime.parseGregorianDateTime(span.start),
> endDate : Timeline.DateTime.parseGregorianDateTime(span.end),
> startLabel : span.title,
> color : span.color
> });
>
> However, this does not seem to work either. Is there another parameter I am missing?
>
> Steve
This causes lots of confusion for folks.
parseGregorianDateTime() basically tries to do two things with a date string:
If it's less than 8 chars long, it assumes it is a year value.
e.g. parseGregorianDateTime will return:
"1995" -> Sun Jan 1 1995
If it is more than 8 chars long, then it calls the JS Date.parse method.
This takes dates in the RFC2822 / IETF date syntax:
"Mon, Dec 25 1995" or "25 Dec 1995" or "December 25, 1995".
Browsers differ in their support of date formats that are not RFC2822. For example, Firefox supports a subset of ISO8601 date formats. Firefox will parse "1995-12-25", Safari will not. Firefox and Safari will parse "12/25/1995" but not "12-25-1995". IE9 supports the ISO8601 date formats. If the date format is not ISO8601, then IE will attempt to parse the date by using (in their words) "other parsing rules".
So your best bets are to format your dates as "25 Dec 1995" or "12/25/1995" if you want to use parseGregorianDateTime.
You say you want to define your dates as "2000-01-01", which is a subset of the ISO8601 format.
You can use Timeline.DateTime.parseIso8601DateTime("1995-12-25").
Hope this helps.
--Mike