System Time (new Date())

Hello guys,

On Wixcode, the “new Date()” javascript seems to retrieve the user’s device time, not the real-time UTC time. I’m building an attendance webApp and I tested for fool-proof but it doesn’t work.

here’s an example; i changed my device time, and the wixcode retrieved the “faked“ time.

this means if an employee is late, the employee can change his/her phone time first then do the attendance so that it seems like the person isn’t late.

Unlike the wix job scheduler tool, it directly converts UTC to the website timezone which is perfect!

I tried using REST API on backend but many of the free ones are http (not secured) which wix refuses to work with.

Do you have a suggestion for my situation?

Thanks in advance

I wonder if this is true. Have you tried to “fake” the time, as you described, and then look in Content Manager what it displays as time? I think new Date() retrieves a UTC date/time, but then the browser adjusts it to locale. Let me know.
If this does not work, you can always retrieve a new Date() from the backend when you are writing the row, like with an beforeInsert hook. But, that time would be identical to the system _createdDate.