Sort by file.day in dataview javascript

What I’m trying to do

I had this dataview query and it worked but I needed to add more complex fields to it so i needed to use javascirpt

the dataview

TASK
FROM "Journal/Dailys"
WHERE !completed
SORT file.day DESC
LIMIT 3

I have no idea how to translate the SORT file.day DESC into javascript that actually sorts it

Things I have tried

Current code

This is the javascript code I have right now.

const tasks = dv.pages('"Journal/Dailys"')
	.sort(p => p.file.day, "desc")
	.file.tasks;
dv.taskList(tasks)

This gets all the tasks from my daily notes but it wont sort it from future to past.
I assume it is an issue with how I wrote the .sort() which is causing it to go through but not actually sort it correctly.