0

I use chap-tim JS component (http://almende.github.io/chap-links-library/timeline.html) that accepts only the following JSON format:

 data = [ { 'start': new Date(2010, 7, 26), 'content': 'test ' } ]; 

I have no problem with all other values accept date ... It will not accept any other format and i have no idia how to emmit the new Date(2010, 7, 26) format.

I use this to set the JSON data in a hidden field and then $.parseJSON to parse it

@Html.Hidden("timeline-data", Json.Encode(Model.GanntItems)); 

and then:

$.parseJSON($("#timeline-data").val()); 

but it emits the following "/Date(1388728800000)/" and its now good...

any way to overcome this ?

1 Answer 1

2

The easiest solution is to parse it in Javascript like following:

 value = new Date(parseInt(value.replace("/Date(", "").replace(")/",""), 10)); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.