Node version: 8.17.0
Sails version _(sails)_: 1.2.4
ORM hook version _(sails-hook-orm)_: 2.1.1
Sockets hook version _(sails-hook-sockets)_: 1.5.5
Grunt hook version _(sails-hook-grunt)_: 3.1.1
DB adapter & version _(sails-mysql)_: 1.0.1
When I lift the sails app, it shows: :: Wed Aug 12 2020 07:42:07 GMT+0530 (IST), which is in IST.
But when I displayed time from a Controller, the timestamp is in UTC. Code: console.log(new Date());.
The timestamp should be in IST, right?
@AJ-Math Thanks for posting! We'll take a look as soon as possible.
In the mean time, there are a few ways you can help speed things along:
Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.
For help with questions about Sails, click here.
@AJ-Math I think this is actually a product of how console.log chooses to convert different object types to strings. In the node REPL, compare:
console.log(new Date())console.log(new Date().toString())> console.log(new Date())
2020-08-13T11:06:49.138Z
> console.log(new Date().toString())
Thu Aug 13 2020 16:36:50 GMT+0530 (India Standard Time)
@alxndrsn The problem is not the date-time string, but the timezone. The sails application lifts showing timezone in IST. When I output the date-time, it's in UTC timezone.
Hi @AJ-Math, If you want a time displayed in a specific timezone you could try using Moment Timezone
@eashaw Hi, I tried and this is working.
Most helpful comment
@AJ-Math I think this is actually a product of how
console.logchooses to convert different object types to strings. In the node REPL, compare:console.log(new Date())console.log(new Date().toString())