jQueryEventCalendar icon indicating copy to clipboard operation
jQueryEventCalendar copied to clipboard

Events not showing in order of time

Open iamleese opened this issue 9 years ago • 1 comments

My events aren't showing in order by time. The json file is correct (and in order). Is there a way to sort by time?

screen shot 2016-08-18 at 3 33 31 pm

{ "date": "2016-08-22 8:00:00", "endtime": "", "title": "Mass ", "description": "Location: Church", "url": "" }, { "date": "2016-08-22 9:00:00", "endtime": "", "title": "Spanish Prayer Group in De Moor Room ", "description": "Location: De Moor Room", "url": "" }, { "date": "2016-08-22 10:00:00", "endtime": "", "title": "Small Church Communities (Krenz) in Room 2 - CMO ", "description": "Location: Room 2 - CMO", "url": "" }, { "date": "2016-08-22 10:00:00", "endtime": "", "title": "Women's Guild Meeting in Room 5 - CMO ", "description": "Location: Room 5 - CMO", "url": "" }, { "date": "2016-08-22 18:00:00", "endtime": "", "title": "Cub Scouts 355 Pack Meeting in Resource Room 1 & 2 ", "description": "Location: Verhoeven Room", "url": "" },

iamleese avatar Aug 18 '16 22:08 iamleese

Solved the issue. The date string needed to be converted to a date object in order to be read correctly.

function sortJson(a, b){ var DateObj; if ( typeof a.date === 'string' ) { //convert to object DateObj = Date.parse(date); return a.DateObj> b.DateObj ? 1 : -1; } return a.date > b.date ? 1 : -1; }

iamleese avatar Aug 22 '16 18:08 iamleese