I have a weird issue, I'm sending new Date()
to API in NextJS. When I check the new Date()
in React side, it shows the current local time
.
But when I console.log()
the request in API side, it doesn't show the local date I'm sending, instead it shows minus 3 by hours. For example, below code
// Sending from React via POST
send({currentTime: new Date()}) // console logs 23:30:30
//API console log
console.log(req.body.currentTime) // console logs 20:30:30
My timezone is UTC+3, so API side doesn't take the time I'm sending and seems like somehow it changes it to the UTC-0 time zone.
Why it doesn't get the local time I'm sending?