I found a way of doing it, but it involves casting, either to date from string (sortDate being custom field value string) or turning created_at into string from date.
I was looking for a solution that was less demanding and didnt require extra work like db migration scripts.
Im not sure how discourse handles custom tables, when it comes to rebasing and upgrading the database.