CTFNote icon indicating copy to clipboard operation
CTFNote copied to clipboard

Past and incoming CTFs aren't displayed if a CTF with a very old date (before 1st january 1970) is created.

Open eeyoretheman opened this issue 1 year ago • 0 comments

If a CTF has a startTime or endTime before 1st January 1970 (before the UNIX epoch) all other Past and Incoming CTFs disappear because the frontend throws an error while parsing the date. Here's a bad temporary fix if anyone wants to fix this now.

in CTFNote/front/src/ctfnote/ctfs.ts, lines 108 and 109

startTime: extractDate(ctf.startTime),
endTime: extractDate(ctf.endTime),

should be

startTime: new Date(ctf.startTime) <= new Date("1970-01-01 00:00") ? new Date(ctf.startTime) : extractDate(ctf.startTime),
endTime: new Date(ctf.endTime) <= new Date("1970-01-01 00:00") ? new Date(ctf.endTime) : extractDate(ctf.endTime),

after that you can rebuild your docker containers with docker-compose up --build -d (remember to use sudo)

I believe the problems stems from the extractDate function in ctfs.ts + the fact that quasar only works with UNIX mils.

Thank you in advance.

eeyoretheman avatar Aug 28 '23 05:08 eeyoretheman