Well, I solved changing the line:
timestamp: someDate.getTime()
in
timestamp: someDate.getTime().toString()
that save the timestamps as string, from the form 1.399374991E12 to 1399374991000 and finally sorting correctly. Weird, it looks a bug in ScriptDb.