I've a timestamp from my database at the gmt zone. How can I display the time based on the user timezone? Currently I`m getting the time like this
return luxon.DateTime.fromSQL(created_at).setZone('local');
It returns the time in gtm.
A cleaner way to handle it is to just tell the parser that the time is expressed in GMT:
DateTime.fromSQL(current_time, {zone: "utc"}).toLocal()
To explain that a bit more, what's happening in your original is that the time string is meant to be interpreted as a GMT time, but Luxon doesn't know that. So it interprets the string as a local time, which is off from the time you meant by the offset. But if Luxon knows "this is expressed in GMT" then it will get the right time in the first place.