Skip to content

Instantly share code, notes, and snippets.

@pgib
Created September 12, 2012 17:17
Show Gist options
  • Select an option

  • Save pgib/3708296 to your computer and use it in GitHub Desktop.

Select an option

Save pgib/3708296 to your computer and use it in GitHub Desktop.
var instances = session.getInstances();
instances.sort(function(a, b)
{
var date1 = parseInt(a.date.replace(/-/g, ""));
var date2 = parseInt(b.date.replace(/-/g, ""));
if (date1 < date2)
{
return -1;
}
else if (date1 > date2)
{
return 1;
}
else if (date1 == date2)
{
var time1 = AttendeaseScheduler.Helper.convertTimeToMinutes(a.time);
var time2 = AttendeaseScheduler.Helper.convertTimeToMinutes(b.time);
if (time1 < time2)
{
return -1;
}
else if (time1 > time2)
{
return 1;
}
else
{
return 0;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment