Sorting list of dates fetched from module by latest to oldest.

Sorting list of dates fetched from module by latest to oldest.

So some quick background - 

We have a module called 'Client Meetings' where there is a custom DateTime field where the sales rep inputs the date that client was met. 

We have a function takes in a Client's ID, then fetches all records in the 'Client Meetings' module tied to that client. 

What I do is then the following:

  1. response = zoho.crm.getRelatedRecords("Client_Meetings","Clients",ClientId);
  2. list_of_meeting_dates = { }

  3. for each  meeting in response
  4. {
  5.     list_of_meeting_dates.add(meeting.getJson("DateTime_of_Meeting"));
  6. }
  7. sorted_list = list_of_meeting_dates.sort(false)
  8. latest_date = sorted_list.get(0)

Basically, I sort the list in descending order, then fetch the first entry.

However this doesn't quite seem to work, because the date "2020-01-17T23:00:00+08:00" appears before the date "2020-01-22T23:00:00+08:00", which it shouldn't.

I'm looking for an elegant solution to solve this issue, as well as general best-practice advice with regard to sorting different field types using Deluge.