I am using dayjs and trying to achieve a datetime conversion depending on the user's locale.
Example;
The data I have is 15 April 2024 America/Toronto 16:00. I want to convert this to user's timezone - i.e Australia/Sydney or Europe/Paris or wherever they are. Also, the data I get won't be only from America/Toronto, it could be a different timezone, so I need to make that dynamic, too.
I thought unix timestamp has the information of timezone(silly me) so I was trying by that conversion only to realise it didn't work because unix is utc based. I do not want to use momentjs for this and thinking we should be able to do this either by dayjs or vanilla js.
See the documentation for the plugin
timezone
(GitHub current commit permalink) and the section on formatting (permalink). Here's a runnable snippet to demonstrate: