Display date and time according to Logged in user's timezone
Hi all
I have an application in which multiple users insert a record and a push notification is sent to other related users but these users have different timezone .
My question is how can I display the record/notification creation time to every user according to his timezone.
Currently I am using created_at column that displays the time only according to the timezone of user who created the record/notification.
It is most likely that the created_at timestamp is consistent (maybe UTC) based on the timezone specified in config/app.php.
You have two choices with regard to showing local time (i) calculate it on the server side based on a known timezone setting for the authenticated user, or (ii) get the local timezone in the user's browser using moment.js or vanilla JS Intl.DateTimeFormat().resolvedOptions().timeZone and convert the UTC time from the server