Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeline: support for ISO Date strings #57

Open
mrmoosehead opened this issue Dec 21, 2012 · 3 comments
Open

Timeline: support for ISO Date strings #57

mrmoosehead opened this issue Dec 21, 2012 · 3 comments
Labels

Comments

@mrmoosehead
Copy link

JSON dates are broken. Everyone knows this.

It would be nice(!) if the handler for loading JSON data would handle the formats that are produced by .NET Json serialiser and other server side stuff without having to preprocess the data.
e.g.

A generic data format (UTC String)

{"items":[
{
"start":"2012-12-20T00:00:00+00:00",
"end":"2012-12-28T00:00:00+00:00",
"content":"Content",
"group":"Group1",
"className":"itemclass"
}
]}

Or the .NET default representation of number of milliseconds since January 1st 1970 UTC

{"items":[
{"start":"/Date(1355961600000)/",
"end":"/Date(1356652800000)/",
"content":"Content",
"group":"Group1",
"className":"itemclass"
}
]}

@mrmoosehead
Copy link
Author

For what it's worth, I can see where to put the change, so if you want a patch for it, I'll have a go

In here I think:
line 3725 (ish)

links.Timeline.prototype.createItem = function(itemData) {
var item = {
'start': itemData.start,
'end': itemData.end,
'content': itemData.content,
'type': itemData.end ? 'range' : this.options.style,
'group': this.getGroup(itemData.group),
'className': itemData.className,
'top': 0,
'left': 0,
'width': 0,
'height': 0,
'lineWidth' : 0,
'dotWidth': 0,
'dotHeight': 0
};
return item;
};

I'd propose a method to parse a non-date itemData.start and itemData.end

@josdejong
Copy link
Contributor

I would be very handy indeed when the Timeline can handle string ISO Dates.

See also: https://groups.google.com/forum/#!topic/chap-links-library/pNXY7P2Bq7g

@josdejong
Copy link
Contributor

I have updated the title of your issue, I hope you don't mind.

josdejong added a commit that referenced this issue Dec 31, 2012
JSON Date parsing for issue #57
josdejong added a commit that referenced this issue Dec 31, 2012
…ion of Dates to the correct output format (See issue #57 and pull request #61)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants