What's the easiest way to find the earliest start date and latest end date from the object below?
(Sorry - I realize there are a lot of similar questions already out there, but my JS skills are poor and I haven't been able to apply any of the solutions to my own data. So with that said, a code example would definitely help me out in any answers - thanks!!)
var ganttData = [
{
"id": 123456,
"name": "Sample Project",
"start": new Date(2010,11,6),
"end": new Date(2011,0,6),
"status": "Not Started",
"phase": [
{
"id": 123457,
"name": "Sample Phase",
"start": new Date(2010,11,6),
"end": new Date(2010,11,13),
"status": "Not Started",
"task": [
{
"id": 123458,
"name": "Sample Task",
"start": new Date(2010,11,6),
"end": new Date(2010,11,8),
"status": "Not Started"
}
]
},
{
"id": 123459,
"name": "Another Phase",
"start": new Date(2010,11,13),
"end": new Date(2011,0,20),
"status": "Not Started"
}
]
}
]
var json = '{"foo": "bar"}';which you then have to parse withJSON.parseinto a JavaScript object in order to accessfoo. Be careful with just changing your question. Comparing the dates as strings is different than comparingDateobjects.