javascript - Displaying time in JSON file on JS Timeline -
i working on developing widget using timeline js template. have able receive events in json format. now, working on receiving them local file. able receive events include date, having trouble getting time work. suggestions have found not seem working. can help?
here json test file:
"events": [{ "start": "2013-03-18", //need add time here "end": "2014-03-18", "title": "test a", "color": "green", "description": "this test", "image": "", "link": "" }, ... ]}
typical date format "yyyy-mm-dd hh:mm:ss.mmm" , these can passed javascript new date(x) constructor (where 'x' is) browsers don't format. want / instead of - , 't' blank separates date , time. see this:
for more details can @ fiddle here
one way shown there seems work in lots of browsers:
var d = '2013-04-30 00:00:00'; var date = new date(d.replace(' ', 't') + 'z')
Comments
Post a Comment