I tried to use a global variable in my worker:
const date1 = new Date();
export default {
async fetch(request) {
const date2 = new Date();
console.log(date1);
console.log(date2);
return new Response("ok");
},
};
Why is date1 always:
Thu Jan 01 1970 00:00:00 GMT+0000 (Coordinated Universal Time)
while date2 contains the correct current date?